-
July 13th, 2004, 11:27 PM
#1
Input string was not in a correct format. mscorlib
ex.Message = Input string was not in a correct format. ex.Source = mscorlib
at the following line I have that error message,
what that problem is ??
Dim GetRow As DataRow = DataSet99.Tables("Documents").Rows.Find(searchPart)
Code:
Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Search.Click
If IsValid Then
Try
SqlConnection1.Open()
Dim searchPart As String = txtName.Text
Dim DataAdapter1 As New SqlClient.SqlDataAdapter("Select * From Documents", SqlConnection1)
Dim Command As New SqlClient.SqlCommandBuilder(DataAdapter1) Dim DataSet99 As New DataSet
DataSet99.Clear()
DataAdapter1.Fill(DataSet99, "Documents")
Dim keys(1) As DataColumn
keys(0) = DataSet99.Tables("Documents").Columns("id_doc")
DataSet99.Tables("Documents").PrimaryKey = keys
'Dim NameS = "id_doc ='" & searchPart & "'"
Dim GetRow As DataRow = DataSet99.Tables("Documents").Rows.Find(searchPart)
txtInNum.Text = GetRow("cod_int")
txtExNum.Text = GetRow("cod_ext")
SqlConnection1.Close()
Catch ex As Exception
ErrorMsg.Text = ex.Message & " " & ex.Source
ErrorMsg.Visible = True
End Try
End If
End Sub
Best regards
Exceter.
-
July 14th, 2004, 12:55 AM
#2
at the following line I have that error message,
what that problem is ??
The problem is your searchPart is not correct. You should pass to find method the primary key value. For example
Code:
table.Rows.Find(10)
-
July 14th, 2004, 01:18 AM
#3
Originally Posted by alexey_1979
The problem is your searchPart is not correct. You should pass to find method the primary key value.
In my code I have a primary key, do not why - now that code works
I made no changes, but the code now works.
Best regards
Exceter.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|