Solved

database cursor

Posted on 2013-10-22
2
197 Views
Last Modified: 2013-10-23
I have a VB2010 console application that i need to connect to a database and retrieve rows.
i have the following that compiles clean.  but the Open command fails for userid.


i have the correct credentials.  
Does anyone see what i'm doing wrong?

 Dim myConnection As New SqlConnection
        Dim myCommand As SqlCommand
        myConnection = New SqlConnection("server=NJTAGS00;uid=XXX;pwd=XXXXX;database=[AGS-CLIENT]")
        myConnection.Open()
        myCommand = New SqlCommand("select RFID,OCRPassageRef,StartOfPassageTime,EndOfPassageTime,Lane FROM [AGS-CLIENT].OCRLane.OCRLane_InGateVehicle Where (OCRLane_InGateVehicle.RFID = '33995655') AND (OCRLane_InGateVehicle.Lane in ('9001','9002')) ORDER BY OCRLane_InGateVehicle.StartOfPassageTime DESC")
0
Comment
Question by:NJJoeG8GT
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39592646
You appear to be connecting to SQL server so the connection string syntax would be

myConnection = New SqlConnection("Data Source=NJTAGS00;user id=XXX;password=XXXXX;Initial Catalog=[AGS-CLIENT]")
0
 
LVL 9

Expert Comment

by:sachinpatil10d
ID: 39592798
Just change as below
uid   to user id
Pwd to password
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now