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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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
HainKurtSr. 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JDL129Author Commented:
Great job!!  Thanks for your help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.