Hello,
What is wong with the following code I am getting “ The ConnectionString
property has not been initialized”
Sub BindDataGrid()
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("P ersist Security
Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t
Timeout=30"))
Const strSQL As String = "mySP"
Dim myCommand As New SqlCommand(strSQL, myConnection)
myConnection.Open()
DataGrid1.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
DataGrid1.DataBind()
End Sub
mySP is a stored procedure wihh is simple “select * from myTable”
Thanks,
Jim. 6 1072
Could be the following:
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("P ersist Security
Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t
Timeout=30"))
That's an awfully long name for an appSetting name...
appSettings is a name/value Collection. If you have a Connection String
stored there, you should refer to it by name.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com... Hello, What is wong with the following code I am getting " The ConnectionString property has not been initialized"
Sub BindDataGrid() Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
Const strSQL As String = "mySP" Dim myCommand As New SqlCommand(strSQL, myConnection)
myConnection.Open() DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction) DataGrid1.DataBind() End Sub
mySP is a stored procedure wihh is simple "select * from myTable" Thanks, Jim.
Kevin, can you me more clear, where can I store connStr? can you give
example, I am new in asp.net
"Kevin Spencer" wrote: Could be the following:
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
That's an awfully long name for an appSetting name...
appSettings is a name/value Collection. If you have a Connection String stored there, you should refer to it by name.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer What You Seek Is What You Get.
"JIM.H." <JI**@discussions.microsoft.com> wrote in message news:2A**********************************@microsof t.com... Hello, What is wong with the following code I am getting " The ConnectionString property has not been initialized"
Sub BindDataGrid() Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
Const strSQL As String = "mySP" Dim myCommand As New SqlCommand(strSQL, myConnection)
myConnection.Open() DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction) DataGrid1.DataBind() End Sub
mySP is a stored procedure wihh is simple "select * from myTable" Thanks, Jim.
Hello JIM.H.,
There's a great article [1] available that demystifies the web.config file.
I recommend you read it to familiarize yourself with the ideas presented.
To solve your problem: In your web.config...
<appSettings>
<add key="connectionString" value="yourConnectionString" />
</appSettings>
In code, do:
ConfigurationSettings.AppSettings["connectionString"]
[1] http://www.sitepoint.com/article/web...le-demystified
--
Matt Berther http://www.mattberther.com Kevin, can you me more clear, where can I store connStr? can you give example, I am new in asp.net
"Kevin Spencer" wrote:
Could be the following:
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
That's an awfully long name for an appSetting name...
appSettings is a name/value Collection. If you have a Connection String stored there, you should refer to it by name.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer What You Seek Is What You Get. "JIM.H." <JI**@discussions.microsoft.com> wrote in message news:2A**********************************@microsof t.com...
Hello, What is wong with the following code I am getting " The ConnectionString property has not been initialized" Sub BindDataGrid() Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30")) Const strSQL As String = "mySP" Dim myCommand As New SqlCommand(strSQL, myConnection) myConnection.Open() DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction) DataGrid1.DataBind() End Sub mySP is a stored procedure wihh is simple "select * from myTable" Thanks, Jim.
Hi Jim:
Configuration.AppSettings is used to retrieve a setting from the
web.config file. You pass it a key name, and it returns the value.
It looks like you already have a value for the connection string, so
remove Configuration.AppSettings and look for some ASP.NET and ADO.NET
tutorials to learn more.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 11 Mar 2005 13:31:06 -0800, JIM.H.
<JI**@discussions.microsoft.com> wrote: Hello, What is wong with the following code I am getting The ConnectionString property has not been initialized
Sub BindDataGrid() Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings(" Persist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
Const strSQL As String = "mySP" Dim myCommand As New SqlCommand(strSQL, myConnection)
myConnection.Open() DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConn ection) DataGrid1.DataBind() End Sub
mySP is a stored procedure wihh is simple select * from myTable Thanks, Jim.
I updated my web.condfig. I got this error:
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
any idea?
"Matt Berther" wrote: Hello JIM.H.,
There's a great article [1] available that demystifies the web.config file. I recommend you read it to familiarize yourself with the ideas presented.
To solve your problem: In your web.config...
<appSettings> <add key="connectionString" value="yourConnectionString" /> </appSettings>
In code, do:
ConfigurationSettings.AppSettings["connectionString"]
[1] http://www.sitepoint.com/article/web...le-demystified
-- Matt Berther http://www.mattberther.com
Kevin, can you me more clear, where can I store connStr? can you give example, I am new in asp.net
"Kevin Spencer" wrote:
Could be the following:
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
That's an awfully long name for an appSetting name...
appSettings is a name/value Collection. If you have a Connection String stored there, you should refer to it by name.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer What You Seek Is What You Get. "JIM.H." <JI**@discussions.microsoft.com> wrote in message news:2A**********************************@microsof t.com...
Hello, What is wong with the following code I am getting " The ConnectionString property has not been initialized" Sub BindDataGrid() Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30")) Const strSQL As String = "mySP" Dim myCommand As New SqlCommand(strSQL, myConnection) myConnection.Open() DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction) DataGrid1.DataBind() End Sub mySP is a stored procedure wihh is simple "select * from myTable" Thanks, Jim.
thanks for your help. I added user to the database, seems working fine.
"Matt Berther" wrote: Hello JIM.H.,
There's a great article [1] available that demystifies the web.config file. I recommend you read it to familiarize yourself with the ideas presented.
To solve your problem: In your web.config...
<appSettings> <add key="connectionString" value="yourConnectionString" /> </appSettings>
In code, do:
ConfigurationSettings.AppSettings["connectionString"]
[1] http://www.sitepoint.com/article/web...le-demystified
-- Matt Berther http://www.mattberther.com
Kevin, can you me more clear, where can I store connStr? can you give example, I am new in asp.net
"Kevin Spencer" wrote:
Could be the following:
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30"))
That's an awfully long name for an appSetting name...
appSettings is a name/value Collection. If you have a Connection String stored there, you should refer to it by name.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer What You Seek Is What You Get. "JIM.H." <JI**@discussions.microsoft.com> wrote in message news:2A**********************************@microsof t.com...
Hello, What is wong with the following code I am getting " The ConnectionString property has not been initialized" Sub BindDataGrid() Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("P ersist Security Info=False;Integrated Security=SSPI;database=myDB;server=MyServer;Connec t Timeout=30")) Const strSQL As String = "mySP" Dim myCommand As New SqlCommand(strSQL, myConnection) myConnection.Open() DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction) DataGrid1.DataBind() End Sub mySP is a stored procedure wihh is simple "select * from myTable" Thanks, Jim. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harry |
last post by:
Using Oracle 8i enterprise on win 2000 (sp3)
Installed the standard configuration & whenever I make a connection it
takes about 10 secs. It's running on a P1900 with 1gb Ram so no reason
there...
|
by: James |
last post by:
We've had a recurring problem where all of a sudden we get a DBMSSOCN
General Network Error on any page that connects to SQL Server. Then we have
to reboot the server and everything works fine...
|
by: Mark |
last post by:
I know that DB2 LUW version 8 has "connection pooling" that provides a
connection concentrator (limits the number of simultaneous connections
that can occur). But does it really provide connection...
|
by: Eric Sabine |
last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET
connection object, SQLConnection to be exact) and then I came across the
following in some microsoft code.
If Not cn Is Nothing...
|
by: Rahul Anand |
last post by:
Getting SQL Exception when trying to implement Connection
based Trasaction using SQL Helper class.
I am using the follwing function to execute my stored
procs:
-=-=-=-
ExecuteScalar(ByVal...
|
by: Suresh |
last post by:
Hi Guys
I have Db2 server installed on remote server. i am connecting to that
remote server by using VPN.
I want to connect that remote DB2 server instance using my local
machine DB2...
|
by: crbd98 |
last post by:
Hello All,
Some time ago, I implemented a data access layer that included a simple
connectin pool. At the time, I did it all by myself: I created N
connections, each connection associated with...
|
by: fniles |
last post by:
I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I use
the exact matching connection string),
1. how can I know how...
|
by: sherifbk |
last post by:
Problem description
==============
- I have 4 clients and 1 server (SQL server)
- 3 clients are Monitoring console 1 client is operation console
- Monitoring console collects some data from...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |