Foros del Web » Programación para mayores de 30 ;) » .NET »

Argument not specified for parameter "" of Public Funtion

Estas en el tema de Argument not specified for parameter "" of Public Funtion en el foro de .NET en Foros del Web. 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' ...
  #1 (permalink)  
Antiguo 23/11/2011, 20:02
 
Fecha de Ingreso: noviembre-2011
Ubicación: frontino
Mensajes: 2
Antigüedad: 12 años, 5 meses
Puntos: 0
Pregunta Argument not specified for parameter "" of Public Funtion

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
  #2 (permalink)  
Antiguo 24/11/2011, 09:24
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: Argument not specified for parameter "" of Public Funtion

Está claro, cuando llamas a la función solo le estás pasando 4 argumentos, cuando en realidad tienes que pasarle 5.

Además el primer argumento es de tipo Integer y tu le estás pasando un argumento de tipo String
  #3 (permalink)  
Antiguo 28/11/2011, 19:03
 
Fecha de Ingreso: noviembre-2011
Ubicación: frontino
Mensajes: 2
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: Argument not specified for parameter "" of Public Funtion

muchas gracias por tu ayuda

Etiquetas: funtion, parameter, public, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:28.