Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your site is a great idea. I should have joined your site years ago. Better late than never..."

Geography

Where in the world do Tek-Tips members come from?

Value of type 'String' cannot be converted to 'System.Data.SqlClient.S

takwirira (Programmer)
4 Jan 08 21:09
Im am getting the error above Value of type 'String' cannot be converted to 'System.Data.SqlClient.SqlConnection' when I try to execute the code to populate a GridView on the website with the query shown below. Any ideas why ?

Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click

LoadData()

End Sub

Private Function LoadData() As DataView

Dim ds As DataSet = New DataSet
Dim cmdSelect As New SqlCommand
Dim da As SqlDataAdapter = New SqlDataAdapter
cmdSelect.CommandText = "Select Name from Runners WHERE Name LIKE 'T%'"

cmdSelect.Connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\runnersdb.mdb" - this bit is underlined as the problem
da.SelectCommand = cmdSelect
da.Fill(ds)

LoadData = ds.Tables(0).DefaultView

GridView1.DataSource = LoadData()
GridView1.DataBind()
End Function


End Class
jadams0173 (TechnicalUser)
4 Jan 08 22:42
This would probably get more timely answers if it were posted in the VB.NET/VB2005 forum796: Visual Basic(Microsoft) -VB.NET/VB2005

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close