SQL and Dataset

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jayuya

    #1

    SQL and Dataset

    got it,
    Just needed to change "*" with "%"
    thanks,
    jayuya
    [color=blue]
    >-----Original Message-----
    >What is wrong with this SQL statement below. I am trying
    >to fill the data grid and apparently there is something
    >wrong with my statament "Like"
    >
    >If I change the SQL to be Where FirstName =??? it works
    >
    >thanks in advance
    >jayuya
    >
    >sql = "SELECT Id,FirstName,Mi ddleName,LastNa me FROM
    >Defendant WHERE FirstName Like '*" &
    >SearchCriteria .ToString & "*';"
    >
    >db.OpenConn( ) 'open db connection
    >db.SetDataAdap ter(sql, "Defendant" ) 'sets the data[/color]
    adapter[color=blue]
    >With Me.DG_Defendant
    > .DataSource = db.DtSet.Tables ("Defendant").D efaultView
    > Try 'binddata
    > .DataBind() 'binds the data to data grid
    > Catch
    > .CurrentPageInd ex = 0
    > .DataBind()
    >End Try
    >End With
    >db.DataAdapter .Dispose() 'close the data adapter
    >db.CloseConn () 'closes db connection
    >.
    >[/color]
Working...