Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesGuys, 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;Init ial Catalog=Ac cessMed;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(Config urationManager.AppSetti ngs["AMConn"]); SqlDataAdapter myCommand = new SqlDataAdapter(strSQ L, myConnection); DataSet objDataSet = new DataSet(); myCommand.Fill(objDataSet, "Client"); DataTable objDataTable = objDataSet.Tables["Client"]; And the error message: "The ConnectionString property has not been initializ ed." I know that there is a problem with my connection because no matter what I p ut 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
Post Follow-up to this messageUse the specific newsgroups for 2005 questions: [url]http://communities.microsoft.com/newsgroups/ICP/sqlserver2005/us/welcomePage.htm[/ url] -- David Portas SQL Server MVP --
Post Follow-up to this messageaspx.cs file. I'm using C# as code behind. "draku" <jkafara@hotmail.com> wrote in message My connection to the db from aspx file:
Post Follow-up to this messageGOT IT! If anyone ever have the same problem this is the solution: SqlConnection myConnection = new SqlConnection(Config urationManager.Connecti onStrings["AMConn"].ConnectionString); "draku" <jkafara@hotmail.com> wrote in message news:dhhakm$dln$1@in ews.gazet a.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;Init ial Catalog=Ac cessMed;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(Config urationManager.AppSetti ngs["AMConn"]); SqlDataAdapter myCommand = new SqlDataAdapter(strSQ L, myConnection); DataSet objDataSet = new DataSet(); myCommand.Fill(objDataSet, "Client"); DataTable objDataTable = objDataSet.Tables["Client"]; And the error message: "The ConnectionString property has not been initializ ed." I know that there is a problem with my connection because no matter what I p ut 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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread