OK, yeah u guessed it. VBnoob here. Like so many other poor souls, lost in a sea of code...heres the dealio-
I know param's need to be completely done and in the correct order for executeNonQuery() to work, but here's my error:
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.
Source Error:
Line 88: DBConnection.Open()
Line 89: Dim iCount As Integer
Line 90: iCount = cmdSoftware.ExecuteNonQuery()
Line 91: DBConnection.Close()
Line 92: If iCount > 0 Then
Source File: c:\inetpub\wwwroot\ASPproject\WebApplication2\SoftwareDB.vb Line: 90
Stack Trace:
[OleDbException (0x80040e10): No value given for one or more required parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
WebApplication2.SoftwareDB.updateEntry(Software Software) in c:\inetpub\wwwroot\ASPproject\WebApplication2\SoftwareDB.vb:90
WebApplication2.WebForm1.btnUpdate_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb:251
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
The relevant code is as follows:
Public Shared Function updateEntry(ByVal Software As Software) As Boolean
Dim sUpdate As String = "UPDATE [SOFTWARE DATABASE] SET " _
& "SoftwareNum=@SoftwareNum, SoftwareName=@SoftwareName, Version=@Version, " _
& "Location=@Location, SoftwareBrand=@SoftwareBrand, DatePurchased=@DatePurchased, " _
& "FirstName=@FirstName, LastName=@LastName, SerialNumber=@SerialNumber, Model=@Model " _
& "WHERE SoftwareNum=@SoftwareNum"
Dim DBConnection As OleDbConnection = Connection()
Dim cmdSoftware As New OleDbCommand(sUpdate, DBConnection)
cmdSoftware.Parameters.Add("@SoftwareNum", Software.SoftwareNum)
cmdSoftware.Parameters.Add("@SoftwareName", Software.SoftwareName)
cmdSoftware.Parameters.Add("@Version", Software.Version)
cmdSoftware.Parameters.Add("@Location", Software.Location)
cmdSoftware.Parameters.Add("@SoftwareBrand", Software.SoftwareBrand)
cmdSoftware.Parameters.Add("@DatePurchased", Software.DatePurchased)
cmdSoftware.Parameters.Add("@FirstName", Software.FirstName)
cmdSoftware.Parameters.Add("@LastName", Software.LastName)
cmdSoftware.Parameters.Add("@SerialNumber", Software.SerialNumber)
cmdSoftware.Parameters.Add("@Model", Software.Model)
DBConnection.Open()
Dim iCount As Integer
iCount = cmdSoftware.ExecuteNonQuery()
DBConnection.Close()
If iCount > 0 Then
Return True
Else
Return False
End If
End Function
I dunno, looks like i have all the needed parameters to me. Am I missing something dumb here? :confused: