Solved

database cursor

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

16 Experts available now in Live!

Get 1:1 Help Now