Hi, Am new in VB.Net.I want to know how to call for data from SQL server usin code. Thanks
AnLag 0 Newbie Poster
Recommended Answers
Jump to PostHave a look at this code snippet for examples.
Jump to PostIf you post the code we can have a look. Please identify which line is throwing the error.
Jump to PostYour problem is likely in your connection string. Sample ADO code for SQL Server is
ListView1.Items.Clear() Dim con As New ADODB.Connection Dim rec As New ADODB.Recordset con.Open("Driver={SQL Server};Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;") rec.Open("SELECT au_lname,au_fname,zip FROM authors WHERE au_lname like 'S%'", con, CursorTypeEnum.adOpenStatic) Do Until rec.EOF ListView1.Items.Add(New ListViewItem({rec("au_lname").Value, rec("au_fname").Value, rec("zip").Value})) rec.MoveNext() Loop …
All 9 Replies
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Mr.M 89 Future Programmers
AnLag 0 Newbie Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
AnLag 0 Newbie Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
AnLag 0 Newbie Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
AnLag 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.