Estoy haciendo un programa enlazado a una base de datos (sql server 2008) y cuando llamo la función isertventa
Argument not specified for parameter 'sdetalle' of 'Public Function insertventa(nid_venta As Integer, sfecha As String, scedula As String, stotal As String, sdetalle As String) As Boolean'.
Este es el código de la función
Function insertventa(ByVal nid_venta As Integer, ByVal sfecha As String, ByVal scedula As String, ByVal stotal As String, ByVal sdetalle As String) As Boolean
Dim caSQL As String = _
"INSERT INTO ventas (id_venta,fecha,cedula,total,detalle) VALUES (?,?,?,?,?)"
Try
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
Dim cmd As OleDbCommand = New OleDbCommand(caSQL, oCnn)
Dim pid_venta As OleDbParameter = New OleDbParameter
Dim pfecha As OleDbParameter = New OleDbParameter
Dim pcedula As OleDbParameter = New OleDbParameter
Dim ptotal As OleDbParameter = New OleDbParameter
Dim pdetalle As OleDbParameter = New OleDbParameter
pid_venta.Value = nid_venta
pfecha.Value = sfecha
pcedula.Value = scedula
ptotal.Value = stotal
pdetalle.Value = sdetalle
cmd.Parameters.Add(pid_venta)
cmd.Parameters.Add(pfecha)
cmd.Parameters.Add(pcedula)
cmd.Parameters.Add(ptotal)
cmd.Parameters.Add(sdetalle)
Dim n As Integer = cmd.ExecuteNonQuery
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
Return n > 0
Catch ex As Exception
MsgBox("Error: " & ex.Message, MsgBoxStyle.Critical, " Error")
Return False
End Try
End Function
Y este el código donde llamo la función
Private Sub ButtonRegistrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRegistrar.Click
GroupBox1.Enabled = True
ButtonRegistrar.Text = "&Guardar"
txtId_venta.Focus()
Dim nRows As Integer = DataGridViewVentas.RowCount
If ButtonRegistrar.Text = "&Guardar" Then
ModuleVentas.insertventa(txtId_venta.Text, DateTimePicker1.Text, txtTotal.Text, txtDetalle.Text)
ModuleGeneral.clearControls(Me)
ModuleVentas.fillBy(DataGridViewVentas)
If nRows <> DataGridViewVentas.RowCount Then ModuleGeneral.moveTo(DataGridViewVentas, DataGridViewVentas.RowCount - 1)
End If
Gracias por su ayuda