Hi!
It's looks like simple problem but I can't solve it. I would like to fill Access databse with one coloumn, just for test. When I connect to database and write number in textbox, confirm with the button it works well. I can see the number writen in the data table. But when I write another number in textbox and confirm with button the number writen in second row of data table is the same as first. So I cannot fill the datatable with different number throug textbox. any idea?
Here is the code thad gives me headacke:
Thanks for answers!
It's looks like simple problem but I can't solve it. I would like to fill Access databse with one coloumn, just for test. When I connect to database and write number in textbox, confirm with the button it works well. I can see the number writen in the data table. But when I write another number in textbox and confirm with button the number writen in second row of data table is the same as first. So I cannot fill the datatable with different number throug textbox. any idea?
Here is the code thad gives me headacke:
VB.NET:
Private Sub vpisi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles vpisi.Click
Try
Integer.Parse(vnosnoPolje.Text)
Catch ex As Exception
MessageBox.Show("Torej" & " " & vnosnoPolje.Text & " " & "je za tebe število?")
End Try
If IsNumeric(vnosnoPolje.Text) = True Then
vnosPod.Connection = baza
vnosPod.CommandText = "INSERT INTO podatki (vhod) VALUES (@vhod)"
vnosPod.Parameters.Add("@vhod", OleDbType.Integer).Value = CInt(vnosnoPolje.Text)
baza.Open()
vnosPod.ExecuteNonQuery()
baza.Close()
vnosnoPolje.Text = ""
Me.PodatkiTableAdapter.Fill(Me.BazaDataSet.podatki)
Me.BazaDataSet.AcceptChanges()
End If
End Sub
Thanks for answers!