Solved

database cursor

Posted on 2013-10-22
2
201 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

Suggested Solutions

Title # Comments Views Activity
"Emulate" TAB key when press Enter Key 3 49
Visual studio 2015 1 22
Generate Unique ID in VB.NET 21 68
MS SQL Conditional WHERE clause 3 15
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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