Good morning, I'm doing an insert from Visual Basic in a SQL Server database from a ComboBox
that I'm filling from a database, at the time of saving the data, in the database me gurda the following:
I have it in classes
Insert complaints
Function Insertar_Queja(ByVal CLIENTE As String, ByVal DIRECCION As String, ByVal CONTACTO As String,
ByVal VENDEDOR As String, ByVal FECHA As Date, ByVal OBSERVACIONES As String, ByVal NOTCREDITO As String) As String
Dim salida As String = "Se genero el Reclamo"
Try
cmd = New SqlCommand("Sp_InsertarQUeja", cn)
cmd.CommandType = CommandType.StoredProcedure
With cmd.Parameters
.AddWithValue("@Cliente", CLIENTE)
.AddWithValue("@DIreccion", DIRECCION)
.AddWithValue("@Contacto", CONTACTO)
.AddWithValue("@Vendedor", VENDEDOR)
.AddWithValue("@Fecha", FECHA)
.AddWithValue("@Observaciones", OBSERVACIONES)
.AddWithValue("@Nota_Credito", NOTCREDITO)
End With
cmd.ExecuteNonQuery()
Catch ex As Exception
salida = "No se genero debido a: " + ex.ToString
End Try
Return salida
End Function
and on the button I have the following:
MsgBox(conn.Insertar_Queja(CmbCliente.SelectedItem.ToString, TxtDireccion.Text, TxtContacto.Text, CmbVendedor.SelectedItem.ToString, CDate(Dtp1.Text), TxtObservaciones.Text, CmbNotaCredito.SelectedItem.ToString))
All calls from this store procedure:
@Cliente as varchar (50),
@Direccion as varchar (50),
@Contacto as varchar (50),
@Vendedor as varchar(50),
@Fecha as date,
@Observaciones as varchar(500),
@Nota_Credito as varchar(50)
as
insert RECLAMOS
(Cliente,Direccion,Contacto,Vendedor,Fecha,Observaciones,Nota_Credito)
values
(@Cliente,@Direccion,@Contacto,@Vendedor,@Fecha,@Observaciones,@Nota_Credito)