Connection error

K

K.K.

Hello all,

I just have a VB.net standard and trying to use the 'old method' (as I did
in VB6) to display some record from my SQL2000 DB.... but it's not
working...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ClickDim Adocon As ADODB.Connection

Global Const CONN_STRING_PPS As String = "Provider=SQLOLEDB.1;" & _
"Persist Security Info=False;User ID=sa;Password=mypswd;" & _
"Initial Catalog=dbsMyDB;Data Source=MyServer"
Adocon.Open(conn_string)

sSql = "Select * from .... blar blar blar"
set rs1 = adocon.execute(sSql)
.......

End sub


I tried to use the server explorer but it return the popular "this version
of vb.net can only connect to the SQL server desktop engine...." - seems the
solution is never answered....

Can someone suggest me how do I get this task done? Thanks in Advance~~

K.K.
 
C

Cor

Hi "K.K.

One of the things that are changed are the connections to databases.
Net is not using (altough you can using a backdoor) recordsets.

When you start with a project I think it is more efficient to look for the
dataset solution, and more because for the recordsets you find slightly
information and almost nobody can help you with it in Net.

I don't know which version from VB.net you have 2002/2003 and I cannot keep
track of all that versions either, but use oledb or sql to connect if
possible.

I hope this helps a little bit.

Cor
 
H

Herfried K. Wagner [MVP]

* "K.K. said:
I just have a VB.net standard and trying to use the 'old method' (as I did
in VB6) to display some record from my SQL2000 DB.... but it's not
working...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ClickDim Adocon As ADODB.Connection

Global Const CONN_STRING_PPS As String = "Provider=SQLOLEDB.1;" & _
"Persist Security Info=False;User ID=sa;Password=mypswd;" & _
"Initial Catalog=dbsMyDB;Data Source=MyServer"
Adocon.Open(conn_string)

sSql = "Select * from .... blar blar blar"
set rs1 = adocon.execute(sSql)
......

End sub

If you have problems with the connection string:

<http://www.connectionstrings.com>

Why not update to ADO.NET?

<
Web interface:

<http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
 
K

K.K.

Hi Cor, Herfried & all,

I am tring to create a database project but after I compeleted the "Add new
Reference" dialogue I got this error (again):
"It is only possible to connect to SQL server desktop engine databases and
microsoft access databases with this version of visual studio"

I'm using VB.Net 2003, really wondering what's the "proper way" to connect
to SQL 2000.... I'm new to .Net if anyone can point me to some good online
resource that will be great!

Thanks~~

K.K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top