ASP.NET/VB.NET - Input is constantly recognized as NULL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello. I'm building a webform that allows users to add records to a
database. The code that adds the new record to the database is below.
Basically a user popualtes 3 textboxes on the webform and those values get
populated into specific columns of a new record.

The problem I'm having is that when I run this, I get an error stating that
the PK column does not allow nulls. Specifically the message says "Column
'FlitchNum' does not allow nulls". This message appears dispite the fact
that a value was entered into txtFlitchNum. The PK column is not an
auto-number column, a user must always input a value when creating a new
record. Could someone please help me understand what's going wrong? Thanks.


--------------------------------------------
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click

Dim log As New LogsDP
Dim logrow As DsLogs.spLogsSelectRow
logrow = DsLogs1.spLogsSelect.NewRow

logrow.FlitchNum = Me.txtFlitchNum.Text
logrow.WhoOrdered = Me.txtWhoOrdered.Text
logrow.VendorName = Me.txtVendor.Text

log.AddLog(logrow)
Response.Redirect("Logs_List.aspx")

End Sub
--------------------------------------------
 
Hard to say what the problem is, but if you're correct when saying that
values are input to the three textboxes, the I suggest looking at the AddLog
method of the LogsDP class. That's one possibility...
 
try this:

logrow.FlitchNum = request("txtFlitchNum")
logrow.WhoOrdered = request("txtWhoOrdered")
logrow.VendorName = request("txtVendor")

hope this works..
 
Back
Top