Connection string from vb6 to sqlServer 2005 express

I need a connection string from vb6 to sqlserver 2005 express:
CAKPOSSERVER\SQLEXPRESS,
Database = "Barcode"
User = "POSiTrack"
PWD = "Fire4635"

Please no links!!

Thanks,
Jerry
JDL129Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
HainKurtConnect With a Mentor Sr. System AnalystCommented:
you assume there is only one record in this table, right?
because you are not looping the table...

here is sample on how to loop the records...
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("/db/northwind.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customers", conn

Response.Write("<ul>")
do until rs.EOF
    Response.Write("<li>")
    for each r in rs.Fields
       Response.Write(r.name)
       Response.Write(" = ")
       Response.Write(r.value & "<br />") 
    next
    rs.MoveNext
loop
Response.Write("</ul>")

rs.close
conn.close

Open in new window

0
 
Rajkumar GsSoftware EngineerCommented:
Try this connectionstring

Provider=SQLOLEDB.1;Data Source =CAKPOSSERVER\SQLEXPRESS;Initial Catalog=Barcode;User ID=POSiTrack;Password=Fire4635;

Raj
0
 
JDL129Author Commented:
RajkumarGS!!!!

How would I use this?

Thanks,
Jerry
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
HainKurtSr. System AnalystCommented:
check here

http://msdn.microsoft.com/en-us/library/bb264566(SQL.90).aspx

Dim cn As ADODB.Connection
Set cn = New Connection
cn.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
        "Persist Security Info=False;" & _
        "AttachDBFileName=" & App.Path & "\northwnd.mdf;Data Source=server1\sqlexpress"
cn.Open
0
 
HainKurtSr. System AnalystCommented:
also try this

adoConn.Open "PROVIDER=MSDataShape;Data Provider=SQLNCLI.1;Persist Security Info=0;User ID=UserName;Password=Password;Initial Catalog=DatabaseName;Data Source=servername"
0
 
JDL129Author Commented:
HainKurt!!!!

I've tried both of these and I keep getting "Object or with block not set"

Dim db As ADODB.Connection
db.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
        "Persist Security Info=False;" & _
        "AttachDBFileName=CAKPOSSERVER\C\PROGRAM FILES\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\BARCODE.MDF;Data Source=CAKPOSSERVER\sqlexpress"
db.Open

db.Open "PROVIDER=MSDataShape;Data Provider=SQLNCLI.1;Persist Security Info=0;User ID=POSiTrack;Password=Fire4635;Initial Catalog=Barcode;Data Source=CAKPOSSERVER\SQLEXPRESS"

What am I missing?
Thanks!!!!
Jerry
0
 
HainKurtSr. System AnalystCommented:
you are missing this

Set cn = New ADODB.Connection
0
 
HainKurtSr. System AnalystCommented:
check 28303147 to see how it is defined, set and used...
0
 
JDL129Author Commented:
HainKurt!!

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Set db = New ADODB.Connection

db.Open "PROVIDER=MSDataShape;Data Provider=SQLNCLI.1;Persist Security Info=0;User ID=POSiTrack;Password=Fire4635;Initial Catalog=Barcode;Data Source=CAKPOSSERVER\SQLEXPRESS"

It appears that the database opens but the error I get now is "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another"  Origianlly this was connected to an Access database and I'd like to connect to the sql server in a way the opening a recordset in sqlserver is not much different from opening it in Access if that's possible.

Set rs = db.OpenRecordset("tblCompany", dbOpenSnapshot)
If rs!INTERFACE = "NONE" Then
    gblnInterface = False
ElseIf rs!INTERFACE = "PSI" Then
    gblnInterface = True
End If

Thanks for your help!!!!
Jerry
0
 
HainKurtSr. System AnalystCommented:
on which line do you get thuis error?
0
 
HainKurtSr. System AnalystCommented:
check here

http://www.w3schools.com/ado/met_rs_open.asp

Set rs = db.OpenRecordset("tblCompany", dbOpenSnapshot)
-->
Set rs = db.OpenRecordset ("tblCompany")
0
 
HainKurtSr. System AnalystCommented:
also change these lines

If rs!INTERFACE = "NONE" Then
    gblnInterface = False
ElseIf rs!INTERFACE = "PSI" Then
    gblnInterface = True
End If

-->
if not rs.EOF Then
  gblnInterface = ( rs("INTERFACE") = "PSI" )
End if
0
 
JDL129Author Commented:
Great job!!  Thanks for your help
0
All Courses

From novice to tech pro — start learning today.