What is Wrong with My Code in
XML / XSL
1
Posts
1
Posters
0
Views
1
Watching
-
am search for certain record in a grid, based on a Column "Lis_key", Field Lis_key in my table constist of strings that are 6 pairs like (XXXXXXXXXXXX),a user will enter 4 Digits, and it should bring all the record that have 4 starting with the input entered by the user through a textbox. i have entered the Following code in my Search Button. PLease Note that my table has relations and both have "Lis_key" Field, the second table"Property_Summary" ,i dont want to do any Edits, only view, but on the Property_Mass, i want to do updates on only one Column. PLease help me on this regard. here is my code in the button.
'Open Database Connection Dim strconnection As String = "workstation id=5875-049;packet size=4096;user id=$$$$$$; Password=######;data source=##########;persist security info=False;initial catalog=Tshwane\_Valuations" Dim cn As SqlConnection = New SqlConnection(strconnection) cn.Open() 'set up data adapter Dim strSql As String = \_ "select Actual\_Extent,Attrib\_code,Lis\_key,Func\_key,Density," \_ & "New\_Net\_Usable\_Extent,New\_Total\_Land\_Factor,New\_AdJ\_Extent\_1,New\_Points\_1," \_ & "New\_ADJ\_Extent\_2, New\_Points\_2, LS\_Prediction, LS\_Confidence,LS\_TYPE from Property\_Mass " Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn) ' Load(DataSet) Dim ds As DataSet = New DataSet da.Fill(ds, "Property\_Mass") 'Set up a new Data adapter Object strSql = "select Property\_Mass.Actual\_Extent,Property\_Mass.Attrib\_code,Property\_Mass.Lis\_key,Property\_Mass.Func\_key,Property\_Mass.Density," \_ & " Property\_Mass.New\_Net\_Usable\_Extent,Property\_Mass.New\_Total\_Land\_Factor,Property\_Mass.New\_AdJ\_Extent\_1, Property\_Mass.New\_Points\_1," \_ & " Property\_Mass.New\_ADJ\_Extent\_2, Property\_Mass.New\_Points\_2, Property\_Mass.LS\_Prediction, Property\_Mass.LS\_Confidence, Property\_Mass.LS\_TYPE," \_ & " Property\_Summary.Purchase\_Date, Property\_Summary.Purchase\_Price" \_ & " from Property\_Mass, Property\_Summary" \_ & "where Substring(Lis\_key,1,4)= " & txtliskeysearch.Text & "'%""" da.SelectCommand.Parameters("Lis\_key").Value = txtliskeysearch.Text If ds.Tables("Property\_Mass").Rows.Count = 0 Then MessageBox.Show("Township not Found") Else da.Fill(ds) End If
when i run the Project it gives no error, but when i search the existing "lis_key", 4 digits from 12. it throws an exc