|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How To :App.ConfigI am having probelms reading the app.config file. I have stored my connectionstring as follows. <add name ="ReqCon" connectionString = "Data Source= {local};Initial Catalog=Tasks_Sch; Integrated Security=SSPI" providerName ="System.Data.SqlClient"/> </connectionStrings> Following is the code in the data layer class: Imports System Imports Microsoft.ApplicationBlocks.Data Imports System.Data Imports System.Data.SqlClient Imports System.Configuration.ConfigurationManager Imports System.Configuration Dim strConnect As String = System.Configuration.ConfigurationManager.AppSettings("ReqCon") cn.ConnectionString = (strConnect) cn.Open() Database server am using is SQL 2005 TIA Regards Because the Net method gives often for some people problems, there is in VB
the much easier namespace My which contains the shared class My.Settings Have a look at that Cor Show quoteHide quote "Sincere" <Sinc***@discussions.microsoft.com> wrote in message news:0DF096F7-37F1-4A08-A62B-9795A7F27366@microsoft.com... > Hello, > > I am having probelms reading the app.config file. I have stored my > connectionstring as follows. > > <add name ="ReqCon" connectionString = > "Data Source= {local};Initial Catalog=Tasks_Sch; > Integrated Security=SSPI" providerName ="System.Data.SqlClient"/> > </connectionStrings> > > > Following is the code in the data layer class: > > Imports System > Imports Microsoft.ApplicationBlocks.Data > Imports System.Data > Imports System.Data.SqlClient > Imports System.Configuration.ConfigurationManager > Imports System.Configuration > > > Dim strConnect As String = > System.Configuration.ConfigurationManager.AppSettings("ReqCon") > cn.ConnectionString = (strConnect) > cn.Open() > > Database server am using is SQL 2005 > > > TIA > > Regards so the namespace name is My.Settings ?
Show quoteHide quote "Cor Ligthert[MVP]" wrote: > Because the Net method gives often for some people problems, there is in VB > the much easier namespace My which contains the shared class > > My.Settings > > Have a look at that > > Cor > > "Sincere" <Sinc***@discussions.microsoft.com> wrote in message > news:0DF096F7-37F1-4A08-A62B-9795A7F27366@microsoft.com... > > Hello, > > > > I am having probelms reading the app.config file. I have stored my > > connectionstring as follows. > > > > <add name ="ReqCon" connectionString = > > "Data Source= {local};Initial Catalog=Tasks_Sch; > > Integrated Security=SSPI" providerName ="System.Data.SqlClient"/> > > </connectionStrings> > > > > > > Following is the code in the data layer class: > > > > Imports System > > Imports Microsoft.ApplicationBlocks.Data > > Imports System.Data > > Imports System.Data.SqlClient > > Imports System.Configuration.ConfigurationManager > > Imports System.Configuration > > > > > > Dim strConnect As String = > > System.Configuration.ConfigurationManager.AppSettings("ReqCon") > > cn.ConnectionString = (strConnect) > > cn.Open() > > > > Database server am using is SQL 2005 > > > > > > TIA > > > > Regards > >
Show quote
Hide quote
"Sincere" wrote: Shouldn't you be using ConfigurationManager.ConnectionStrings, rather than > Hello, > > I am having probelms reading the app.config file. I have stored my > connectionstring as follows. > > <add name ="ReqCon" connectionString = > "Data Source= {local};Initial Catalog=Tasks_Sch; > Integrated Security=SSPI" providerName ="System.Data.SqlClient"/> > </connectionStrings> > > > Following is the code in the data layer class: > > Imports System > Imports Microsoft.ApplicationBlocks.Data > Imports System.Data > Imports System.Data.SqlClient > Imports System.Configuration.ConfigurationManager > Imports System.Configuration > > > Dim strConnect As String = > System.Configuration.ConfigurationManager.AppSettings("ReqCon") > cn.ConnectionString = (strConnect) > cn.Open() > > Database server am using is SQL 2005 > > > TIA > > Regards ConfigurationManager.AppSettings? Mike
How do I create new app with data access?
Concurrency error on update VB.NET Charting Solution HTML, CSS and JavaScript in a Gridview System.OutOfMemory exception error is this possible? Pass a structure to a C++ dll Duplicated data - how to understand it please? Floating Point Math Problem Launch .NET application through notification or windows messaging Option |
|||||||||||||||||||||||