473,322 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

new sqlconnection problem

I want to use a table store the database connection. (e.g myDBC)

I use cmdReader to get the string from that table sucesfully and then want
to create it .
Dim strConnection as string = myReader.item(conn)
Dim cnSqlServer as new SqlConnection(strConnection)

I check that I can get the strConnection very well. (e.g "server=MyServer;
database=Account;user id =sa;password=;")
However, as newSqlConnection(strConnection) it got errors.

Does anyone try this similar approach ?? Thanks a lot
Nov 21 '05 #1
3 1392
Hi,

What's your error? And have you got option strict on turned on, so you can
check it's not a converting error

Greetz Peter

"Agnes" <ag***@dynamictech.com.hk> schreef in bericht
news:ut**************@TK2MSFTNGP12.phx.gbl...
I want to use a table store the database connection. (e.g myDBC)

I use cmdReader to get the string from that table sucesfully and then want
to create it .
Dim strConnection as string = myReader.item(conn)
Dim cnSqlServer as new SqlConnection(strConnection)

I check that I can get the strConnection very well. (e.g "server=MyServer;
database=Account;user id =sa;password=;")
However, as newSqlConnection(strConnection) it got errors.

Does anyone try this similar approach ?? Thanks a lot

Nov 21 '05 #2
As i run the form ,unknow command "user id"

"Peter Proost" <pp*****@nospam.hotmail.com> ¼¶¼g©ó¶l¥ó·s»D:ea***************@tk2msftngp13.phx. gbl...
Hi,

What's your error? And have you got option strict on turned on, so you can
check it's not a converting error

Greetz Peter

"Agnes" <ag***@dynamictech.com.hk> schreef in bericht
news:ut**************@TK2MSFTNGP12.phx.gbl...
I want to use a table store the database connection. (e.g myDBC)

I use cmdReader to get the string from that table sucesfully and then
want
to create it .
Dim strConnection as string = myReader.item(conn)
Dim cnSqlServer as new SqlConnection(strConnection)

I check that I can get the strConnection very well. (e.g
"server=MyServer;
database=Account;user id =sa;password=;")
However, as newSqlConnection(strConnection) it got errors.

Does anyone try this similar approach ?? Thanks a lot


Nov 21 '05 #3
Hi,

I would try this:

Dim strConnection as string = cstr(myReader.item(conn))

Then set a breakpoint at the next line, and make sure the Connection string
is correct:
breakpoint at: Dim cnSqlServer as new SqlConnection(strConnection)
Connection string should look like this:
"Data Source=\\Servername;Initial Catalog=DatabaseName;User
Id=something;Password=something;"

Btw when can you connect to the server if you type the connection string in
the program and don't get it from the reader?

Greetz Peter

"Agnes" <ag***@dynamictech.com.hk> schreef in bericht
news:#u**************@TK2MSFTNGP09.phx.gbl...
As i run the form ,unknow command "user id"

"Peter Proost" <pp*****@nospam.hotmail.com>

¼¶¼g©ó¶l¥ó·s»D:ea***************@tk2msftngp13.phx. gbl...
Hi,

What's your error? And have you got option strict on turned on, so you can check it's not a converting error

Greetz Peter

"Agnes" <ag***@dynamictech.com.hk> schreef in bericht
news:ut**************@TK2MSFTNGP12.phx.gbl...
I want to use a table store the database connection. (e.g myDBC)

I use cmdReader to get the string from that table sucesfully and then
want
to create it .
Dim strConnection as string = myReader.item(conn)
Dim cnSqlServer as new SqlConnection(strConnection)

I check that I can get the strConnection very well. (e.g
"server=MyServer;
database=Account;user id =sa;password=;")
However, as newSqlConnection(strConnection) it got errors.

Does anyone try this similar approach ?? Thanks a lot



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nayt Grochowski | last post by:
Does anyone see any problem with the loading a SqlConnection into the System.Web.HttpContextCurrent.Items collection in a Page's Constructor. Then Closing and Disposing of it the OnUnload method? ...
1
by: Skip Key | last post by:
While writing a windows service, I've run into a fairly strange problem. I have a worker proc that gets fired every n seconds using System.Threading.Timer. This works fine, unless I open an...
4
by: The Coolest Dolphin | last post by:
Hi all, I have a question/problem concerning usage of my sqlconnection throughout my program. In my main form (frmMain) I defined an sqlconnection (I've set the connection public so that I can...
13
by: MuZZy | last post by:
Hi, Just wanted to make sure i get it right: consider this class: // =========== START CODE ============= class Test { private SqlConnection con = null; public void Connect() { con = new...
16
by: ed_p | last post by:
Hello, I have implemented the singleton pattern for a class to hold a SqlConnection object that will be used thruout the application to create commands. My application is a simple Windows Form...
1
by: Mark | last post by:
I have an SqlConnection object defined as a member of main form. I also have a thread that creates an SqlDataReader but uses the same SqlConnection object. The SqlDataReader simple loops round for...
3
by: Ludvig | last post by:
This Exception is executed when using SQLConnection. OleDbConnection connects fine. System.EnterpriseServices.Platform.Initialize() +503...
1
by: jinfeng_Wang | last post by:
hi, I have a question about the difference between SqlConnection.IDisposable.Dispose() and SqlConnection.Dispose(). Both of them realize the function of releasing the connection to the...
4
by: Victor | last post by:
Hi Guys I have a problem here. I want to improve the performance for a website. When I looked into the system, I have found that the system made the "SqlConnection Object" static. That mean only...
4
by: =?Utf-8?B?VG9kZCBKYXNwZXJz?= | last post by:
Hey guys, I've written a web application that I'm simply trying to use to access a database. When I run the application locally (or as an NT Service) it can easily access the remote SQL...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.