Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

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;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


Report this thread to moderator Post Follow-up to this message
Old Post
draku
09-29-05 06:23 PM


Re: ASP.NET + SQL 2005
Use the specific newsgroups for 2005 questions:
[url]http://communities.microsoft.com/newsgroups/ICP/sqlserver2005/us/welcomePage.htm[/
url]

--
David Portas
SQL Server MVP
--


Report this thread to moderator Post Follow-up to this message
Old Post
David Portas
09-29-05 06:23 PM


Re: ASP.NET + SQL 2005
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:


Report this thread to moderator Post Follow-up to this message
Old Post
draku
09-29-05 06:23 PM


Re: ASP.NET + SQL 2005
GOT 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


Report this thread to moderator Post Follow-up to this message
Old Post
draku
09-30-05 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 01:52 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006