473,397 Members | 2,033 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,397 software developers and data experts.

Connection to SQL server

TS
Hi all,

I'm trying to connect to an SQL database from my vb.net form, but getting an
error message. The code I used is the following:

Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim myConnection As SqlClient.SqlConnection
myConnection.ConnectionString = "Persist Security
Info=true;Integrated Security=false;User
ID=sa;Password=xxxxx;database=yyy;server=zzzzz\mmm mm"
myConnection.Open()
End Sub

What am I missing?

--
TS
Nov 22 '05 #1
5 1178
On Thu, 3 Feb 2005 07:15:08 -0800, "TS" <TS@discussions.microsoft.com> wrote:

¤ Hi all,
¤
¤ I'm trying to connect to an SQL database from my vb.net form, but getting an
¤ error message. The code I used is the following:
¤
¤ Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
¤ System.EventArgs) Handles ConnectSQL.Click
¤ Dim myConnection As SqlClient.SqlConnection
¤ myConnection.ConnectionString = "Persist Security
¤ Info=true;Integrated Security=false;User
¤ ID=sa;Password=xxxxx;database=yyy;server=zzzzz\mmm mm"
¤ myConnection.Open()
¤ End Sub
¤
¤ What am I missing?

A data source?

See if the following examples help:

http://www.able-consulting.com/dotne...anagedProvider
http://www.connectionstrings.com (SqlConnection (.NET))
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 22 '05 #2
TS
Thanks for your reply.
Is the data source in your example (data source=local) equivalent to the
server name provided in the connection string of my code
(server=zzzzz\mmmmm)? If yes, this shouldn't be the issue. If no, what do you
mean by data source?

Thank you

"Paul Clement" wrote:
On Thu, 3 Feb 2005 07:15:08 -0800, "TS" <TS@discussions.microsoft.com> wrote:

¤ Hi all,
¤
¤ I'm trying to connect to an SQL database from my vb.net form, but getting an
¤ error message. The code I used is the following:
¤
¤ Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
¤ System.EventArgs) Handles ConnectSQL.Click
¤ Dim myConnection As SqlClient.SqlConnection
¤ myConnection.ConnectionString = "Persist Security
¤ Info=true;Integrated Security=false;User
¤ ID=sa;Password=xxxxx;database=yyy;server=zzzzz\mmm mm"
¤ myConnection.Open()
¤ End Sub
¤
¤ What am I missing?

A data source?

See if the following examples help:

http://www.able-consulting.com/dotne...anagedProvider
http://www.connectionstrings.com (SqlConnection (.NET))
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 22 '05 #3
TS wrote:
Hi all,

I'm trying to connect to an SQL database from my vb.net form, but getting an
error message. The code I used is the following:

Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim myConnection As SqlClient.SqlConnection
myConnection.ConnectionString = "Persist Security
Info=true;Integrated Security=false;User
ID=sa;Password=xxxxx;database=yyy;server=zzzzz\mmm mm"
myConnection.Open()
End Sub

What am I missing?


Maybe this:
Dim myConnection As New SqlClient.SqlConnection()

--
Rinze van Huizen
C-Services Holland b.v.
Nov 22 '05 #4
On Thu, 3 Feb 2005 12:11:08 -0800, "TS" <TS@discussions.microsoft.com> wrote:

¤ Thanks for your reply.
¤ Is the data source in your example (data source=local) equivalent to the
¤ server name provided in the connection string of my code
¤ (server=zzzzz\mmmmm)? If yes, this shouldn't be the issue. If no, what do you
¤ mean by data source?

I didn't see the "server" argument the first time I looked at the connection string. I don't see any
problem with the syntax.

What is the error you are getting?
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 22 '05 #5
You need an instance of the SqlConnection object.

Dim myConnection As SqlClient.SqlConnection = new SqlClient.SqlConnection

"TS" <TS@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Hi all,

I'm trying to connect to an SQL database from my vb.net form, but getting
an
error message. The code I used is the following:

Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim myConnection As SqlClient.SqlConnection
myConnection.ConnectionString = "Persist Security
Info=true;Integrated Security=false;User
ID=sa;Password=xxxxx;database=yyy;server=zzzzz\mmm mm"
myConnection.Open()
End Sub

What am I missing?

--
TS

Nov 22 '05 #6

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

Similar topics

13
by: Fortepianissimo | last post by:
Here is the situation: I want my server started up upon connection. When the first connection comes in, the server is not running. The client realizes the fact, and then starts up the server and...
6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
6
by: Sharon | last post by:
Hi all. I'm trying first time async socket connection. In all the examples i've seen, the server connection is closed when the message is complete. Is it common to close the connection after...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
5
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...
16
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...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
20
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...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.