We help IT Professionals succeed at work.
Get Started

sqladapter - fill method

VBdotnet2005 asked
Last Modified: 2012-03-15
I keep getting an error here - da.fill(ds, "table1")  It looks good to me.

I keep getting an error here - da.fill(ds, "table1")  It looks good to me.
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myconstring As String = WebConfigurationManager.ConnectionStrings("myConnectionString").ToString
        Dim mycon As New SqlConnection(myconstring)
        Dim selecteddate As String = "select [datetime], accountnumber  from mytable where ([datetime] >= convert(datetime, '" & Trim(Date1.Text) & " 00:00:00', 101)) and ([datetime] <= CONVERT(DATETIME, '" & Trim(Date1.Text) & " 23:59:59' , 101 ))"
        Dim da As New SqlDataAdapter(selecteddate, mycon)
        Dim ds As New DataSet
        da.Fill(ds, "table1")   - ----------- Incorrect syntax near '='.
        Me.GridView1.DataSource = ds.Tables("table1")
    End Sub

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE