Showing posts with label config. Show all posts
Showing posts with label config. Show all posts

Friday, February 24, 2012

aspnetdb connection string not found

Why I don't have connection string in web.config for aspnetdb.mdf database although the site works?Help plz?

You could have connection string in web.config,and reference it in your code,take gridview for example:

<asp:SqlDataSource ID="SqlDataSourcel" Runat="server"ProviderName="System.Data.SqlClient"ConnectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=Northwind;Persist Security Info=True"SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice] FROM[Products]"></asp:SqlDataSource>or "SqlDataSource1" runat="server" DataSourceMode="DataReader" ConnectionString="<%$ ConnectionStrings:MyNorthwind%>" SelectCommand="SELECT FirstName, LastName, Title FROM Employees">
In your soucecode you should find ConnectionString .|||The connection string for the database file created in your application is auto generated, you may take a look at this post:http://forums.asp.net/thread/1430985.aspx

Monday, February 13, 2012

ASP.NET ReportViewer control (IReportServerConnection2) Invalid UR

Hi -- I'm trying to use the ReportViewer control in an ASP.net app. I'm
positive the web.config settings are correct (server url, username, p/w,
etc.).
I keep getting "Invalid URI: the hostname could not be parsed".
Any ideas?
I can get this to work using the WinForms ReportViewer control (same RS2005
server and credentials)...
Thanks!Did you ever figure out your problem with the "Invalid:URI The hostname cannot be parsed"?
I'm running into the same problem.
EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com|||No I didn't...
"Mark" wrote:
> Did you ever figure out your problem with the "Invalid:URI The hostname cannot be parsed"?
> I'm running into the same problem.
> EggHeadCafe - .NET Developer Portal of Choice
> http://www.eggheadcafe.com
>

Thursday, February 9, 2012

ASP.NET + SQL 2005

Guys, I have a problem with setting up connection from asp file to MS Sql db.
I'm using Web.Config as the file to setup the connection:
<connectionStrings
<add name="AMConn" connectionString="Data Source=TWS_WS04;Initial Catalog=AccessMed;Integrated Security=True"

providerName="System.Data.SqlClient" /
</connectionStrings
My connection to the db from aspx file:

string strSQL = "SELECT * FROM Client";

SqlConnection myConnection = new SqlConnection(ConfigurationManager.AppSettings["AMConn"]);

SqlDataAdapter myCommand = new SqlDataAdapter(strSQL, myConnection);

DataSet objDataSet = new DataSet();

myCommand.Fill(objDataSet, "Client");

DataTable objDataTable = objDataSet.Tables["Client"];

And the error message: "The ConnectionString property has not been initialized."

I know that there is a problem with my connection because no matter what I put as AppSettings["ANYTHING I WANT"]); - the error is always the same.

I'm new to asp.net and I would appreciate any help.

Thanks,

JimUse the specific newsgroups for 2005 questions:
http://communities.microsoft.com/ne...welcomePage.htm

--
David Portas
SQL Server MVP
--|||aspx.cs file. I'm using C# as code behind.

"draku" <jkafara@.hotmail.com> wrote in message

My connection to the db from aspx file:|||GOT IT!
If anyone ever have the same problem this is the solution:
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrin gs["AMConn"].ConnectionString);

"draku" <jkafara@.hotmail.com> wrote in message news:dhhakm$dln$1@.inews.gazeta.pl...
Guys, I have a problem with setting up connection from asp file to MS Sql db.
I'm using Web.Config as the file to setup the connection:
<connectionStrings
<add name="AMConn" connectionString="Data Source=TWS_WS04;Initial Catalog=AccessMed;Integrated Security=True"

providerName="System.Data.SqlClient" /
</connectionStrings
My connection to the db from aspx file:

string strSQL = "SELECT * FROM Client";

SqlConnection myConnection = new SqlConnection(ConfigurationManager.AppSettings["AMConn"]);

SqlDataAdapter myCommand = new SqlDataAdapter(strSQL, myConnection);

DataSet objDataSet = new DataSet();

myCommand.Fill(objDataSet, "Client");

DataTable objDataTable = objDataSet.Tables["Client"];

And the error message: "The ConnectionString property has not been initialized."

I know that there is a problem with my connection because no matter what I put as AppSettings["ANYTHING I WANT"]); - the error is always the same.

I'm new to asp.net and I would appreciate any help.

Thanks,

Jim