Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL UPDATEing a datebase in VB.NET, having troubles
    text
    copied!<p>I am using a data grid view to display information from a database and I can't get it to update correctly. I can see the data from the database but when I change information and save it it changes the entire column's information. My rows need to have different values in the same column so this is a problem.</p> <p>-Here is my code so far, what the program does is makes a list of transactions that are entered.</p> <pre><code>Public Class Form1 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If MsgBox("Add new transaction?", MsgBoxStyle.YesNo, " ") &lt;&gt; 7 Then If IsNumeric(in_cost.Text) Then Dim x As Int16 = Database1DataSet.Table1.Count + 1 '//gets # value Me.Table1TableAdapter.Insert(Format(Now, "dddd, M/dd/yy"), x, in_cost.Text, in_prod.Text, in_type.Text, in_note.Text, 9999.99) '//Writes new index to DB table Me.Table1TableAdapter.Fill(Me.Database1DataSet.Table1) Else MsgBox("Cost is non-numeric!") End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Table1TableAdapter.Fill(Me.Database1DataSet.Table1) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Table1TableAdapter.Fill(Me.Database1DataSet.Table1) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Table1TableAdapter.Update(Me.Database1DataSet.Table1) End Sub End Class </code></pre> <p>-SQL UPDATE command:</p> <pre><code>UPDATE Table1 SET Balance = @p1, Note = @p2, Type = @p3, Product = @p4, Cost = @p5, # = @p6, Date = @p7 </code></pre> <p>Thanks in advance for any help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload