GOT IT!
If anyone ever have the same problem this is the solution:
SqlConnection myConnection =3D new =
SqlConnection(ConfigurationManager.ConnectionStrings["AMConn"].Connection=
String);
[quoted text, click to view] "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.=20
I'm using Web.Config as the file to setup the connection:
<connectionStrings>
<add name=3D"AMConn" connectionString=3D"Data =
Source=3DTWS_WS04;Initial Catalog=3DAccessMed;Integrated =
Security=3DTrue"
providerName=3D"System.Data.SqlClient" />
</connectionStrings>
My connection to the db from aspx file:
string strSQL =3D "SELECT * FROM Client";
SqlConnection myConnection =3D new =
SqlConnection(ConfigurationManager.AppSettings["AMConn"]);
SqlDataAdapter myCommand =3D new SqlDataAdapter(strSQL, myConnection);
DataSet objDataSet =3D new DataSet();
myCommand.Fill(objDataSet, "Client");
DataTable objDataTable =3D objDataSet.Tables["Client"];
And the error message: "The ConnectionString property has not been =
initialized."=20
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,