Connection String not initialized
Connection String not initialized
am 24.01.2008 21:33:12 von rodchar
hey all,
SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
DataTable tbl = new DataTable();
da.Fill(tbl);
Can someone please tell me what I'm missing?
thanks,
rodchar
Re: Connection String not initialized
am 24.01.2008 21:49:58 von Scott Roberts
Connection strings are *typically* stored in the section
of web.config, not . If that's the case, try this:
string dbConnection =
ConfigurationManager.ConnectionStrings["NorthwindConnectionS tring"].ConnectionString;
"rodchar" wrote in message
news:63B6AC3A-53FC-48D2-AAED-1BCE67565338@microsoft.com...
> hey all,
>
> SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
> ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
> DataTable tbl = new DataTable();
> da.Fill(tbl);
>
> Can someone please tell me what I'm missing?
>
> thanks,
> rodchar
RE: Connection String not initialized
am 24.01.2008 22:10:20 von mily242
Hi there Rod,
Don't get me wrong but I would suggest you to start using every's
programmer's best friend - debugger. In this particular case seems connection
string is not defined in app settings, maybe there's a typo in the web.config
or it's defined but under connectionStrings section. Debugger will save you
time as you can pick up bugs much quicker than asking questions and waiting
for the reply.
Have a good night
--
Milosz
"rodchar" wrote:
> hey all,
>
> SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
> ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
> DataTable tbl = new DataTable();
> da.Fill(tbl);
>
> Can someone please tell me what I'm missing?
>
> thanks,
> rodchar
RE: Connection String not initialized
am 24.01.2008 22:54:35 von rodchar
You are right that it's in the connectionStrings section, how do you get to
that?
"Milosz Skalecki [MCAD]" wrote:
> Hi there Rod,
>
> Don't get me wrong but I would suggest you to start using every's
> programmer's best friend - debugger. In this particular case seems connection
> string is not defined in app settings, maybe there's a typo in the web.config
> or it's defined but under connectionStrings section. Debugger will save you
> time as you can pick up bugs much quicker than asking questions and waiting
> for the reply.
>
> Have a good night
> --
> Milosz
>
>
> "rodchar" wrote:
>
> > hey all,
> >
> > SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
> > ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
> > DataTable tbl = new DataTable();
> > da.Fill(tbl);
> >
> > Can someone please tell me what I'm missing?
> >
> > thanks,
> > rodchar
Re: Connection String not initialized
am 24.01.2008 22:57:53 von David Wier
What exactly do you mean by 'how do you get to that?"
The web.config file is a file, like any other in the root directory of the
website, that you can open and edit.
David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"rodchar" wrote in message
news:21E0204C-AE4D-4021-AC4F-E82324556A30@microsoft.com...
> You are right that it's in the connectionStrings section, how do you get
> to
> that?
>
> "Milosz Skalecki [MCAD]" wrote:
>
>> Hi there Rod,
>>
>> Don't get me wrong but I would suggest you to start using every's
>> programmer's best friend - debugger. In this particular case seems
>> connection
>> string is not defined in app settings, maybe there's a typo in the
>> web.config
>> or it's defined but under connectionStrings section. Debugger will save
>> you
>> time as you can pick up bugs much quicker than asking questions and
>> waiting
>> for the reply.
>>
>> Have a good night
>> --
>> Milosz
>>
>>
>> "rodchar" wrote:
>>
>> > hey all,
>> >
>> > SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
>> > ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
>> > DataTable tbl = new DataTable();
>> > da.Fill(tbl);
>> >
>> > Can someone please tell me what I'm missing?
>> >
>> > thanks,
>> > rodchar
Re: Connection String not initialized
am 24.01.2008 23:19:04 von Scott Roberts
string dbConnection =
ConfigurationManager.ConnectionStrings["NorthwindConnectionS tring"].ConnectionString;
"rodchar" wrote in message
news:21E0204C-AE4D-4021-AC4F-E82324556A30@microsoft.com...
> You are right that it's in the connectionStrings section, how do you get
> to
> that?
>
> "Milosz Skalecki [MCAD]" wrote:
>
>> Hi there Rod,
>>
>> Don't get me wrong but I would suggest you to start using every's
>> programmer's best friend - debugger. In this particular case seems
>> connection
>> string is not defined in app settings, maybe there's a typo in the
>> web.config
>> or it's defined but under connectionStrings section. Debugger will save
>> you
>> time as you can pick up bugs much quicker than asking questions and
>> waiting
>> for the reply.
>>
>> Have a good night
>> --
>> Milosz
>>
>>
>> "rodchar" wrote:
>>
>> > hey all,
>> >
>> > SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
>> > ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
>> > DataTable tbl = new DataTable();
>> > da.Fill(tbl);
>> >
>> > Can someone please tell me what I'm missing?
>> >
>> > thanks,
>> > rodchar
RE: Connection String not initialized
am 25.01.2008 01:16:22 von mily242
Howdy,
c#
System.Configuration.ConfigurationManager.ConnectionStrings[ "ConnectionStringName"].ConnectionString
vb.net
System.Configuration.ConfigurationManager.ConnectionStrings( "ConnectionStringName").ConnectionString
HTH
--
Milosz
"rodchar" wrote:
> You are right that it's in the connectionStrings section, how do you get to
> that?
>
> "Milosz Skalecki [MCAD]" wrote:
>
> > Hi there Rod,
> >
> > Don't get me wrong but I would suggest you to start using every's
> > programmer's best friend - debugger. In this particular case seems connection
> > string is not defined in app settings, maybe there's a typo in the web.config
> > or it's defined but under connectionStrings section. Debugger will save you
> > time as you can pick up bugs much quicker than asking questions and waiting
> > for the reply.
> >
> > Have a good night
> > --
> > Milosz
> >
> >
> > "rodchar" wrote:
> >
> > > hey all,
> > >
> > > SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
> > > ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
> > > DataTable tbl = new DataTable();
> > > da.Fill(tbl);
> > >
> > > Can someone please tell me what I'm missing?
> > >
> > > thanks,
> > > rodchar
RE: Connection String not initialized
am 31.01.2008 14:50:01 von rodchar
thanks again everyone for the feedback.
rod.
"rodchar" wrote:
> hey all,
>
> SqlDataAdapter da = new SqlDataAdapter(@"Select * from Products",
> ConfigurationSettings.AppSettings["NorthwindConnectionString "]);
> DataTable tbl = new DataTable();
> da.Fill(tbl);
>
> Can someone please tell me what I'm missing?
>
> thanks,
> rodchar