Hi,
I have few comboboxes on my form which has data bounded from a table from my SQL database.
For example;
.AddWithValue("@Paystatus", Me.cmbpaystatus.SelectedIndex.ToString)
Paystatus combo box has dropdownlist from a table as shown below
PaystatusID Paystatus
1 Full Pay
2 No Pay
3 Part Pay
If I select No Pay - Instead of saving No Pay it stores value 2 and so on..
Whats wrong?
Thanks
I have few comboboxes on my form which has data bounded from a table from my SQL database.
Code:
Try
Dim sql As String = "INSERT INTO dbo.TblOrderPayment (RefNo, Paystatus, ModeofPayment, AmountPaid, Balance, TotalAmount, Username) " & _
"VALUES (@RefNo, @Paystatus, @ModeofPayment, @AmountPaid, @Balance, @TotalAmount, @Username)"
Dim cmd As New SqlCommand(sql, conn)
With cmd.Parameters
.AddWithValue("@RefNo", txtsurname.Text.Substring(0, 3).ToUpper)
.AddWithValue("@Paystatus", Me.cmbpaystatus.SelectedIndex.ToString)
.AddWithValue("@ModeofPayment", Me.cmbmode.SelectedIndex.ToString)
.AddWithValue("@AmountPaid", txtamt.Text)
.AddWithValue("@Balance", txtBal.Text)
.AddWithValue("@TotalAmount", TxtSubTotal.Text)
.AddWithValue("@Username", FrmMain.ToolStripTextBox2.Text)
End With
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Spare Elements")
End Try
.AddWithValue("@Paystatus", Me.cmbpaystatus.SelectedIndex.ToString)
Paystatus combo box has dropdownlist from a table as shown below
PaystatusID Paystatus
1 Full Pay
2 No Pay
3 Part Pay
If I select No Pay - Instead of saving No Pay it stores value 2 and so on..
Whats wrong?
Thanks