tengo este sub dond cargo 1 sp q m carga 1 regisitros q tienen como valor comun 1 numero d documento..... y si en mi formulario lo digito el num d documento y ese numero ya existe .... q lo busk d la base d datos y m jale los valores q le pido .....
Cita:
el d arriba es el sub q contiene el sp con el procedimiento para recuperar esos valores.... lo q kiero hacer es q cuando escriba el num d documento imagino q hara 1 postback y ahi kiero q se vean los datos en los txtbox y en los ddl... solo creo q necesito saber es en evento poner este sub .... espero contar con su ayuda sub leercNumDocumento(sender1 as Object, e1 as EventArgs)
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
Dim objAdapter As SqlDataAdapter
Dim strSQLQuery As String
' Set up our connection.
objConnection = New SqlConnection("Data Source=(local); Initial Catalog=sigaf; user id=sa; password=sa159")
' Set up our SQL query text.
strSQLQuery = "sp_sRelacion_TableroControl_cNumDocum_Gas " & TxtNumDocumento.text
' Create new command object passing it our SQL query
' and telling it which connection to use.
objCommand = New SqlCommand(strSQLQuery, objConnection)
'abrimos la conexion
objConnection.open()
Dim rs As SqlDataReader = objCommand.ExecuteReader
rs.read
TxtAPaterno.text = rs("cApePaterno")
TxtAMaternotext = rs("cApeMaterno")
txtNombretext = rs("cNombres")
ddlday5.selectedvalue = day(rs("dFechaNacimiento"))
ddlmonth5.selectedindex = month(rs("dFechaNacimiento")) - 1
ddlyear5.selectedvalue = year(rs("dFechaNacimiento"))
ddlday2.selectedvalue = day(rs("dFechaVigDocCon"))
ddlmonth2.selectedindex = month(rs("dFechaVigDocCon")) - 1
ddlyear2.selectedvalue = year(rs("dFechaVigDocCon"))
ddlday4.selectedvalue = day(rs("dFechaSOAT"))
ddlmonth4.selectedindex = month(rs("dFechaSOAT")) - 1
ddlyear4.selectedvalue = year(rs("dFechaSOAT"))
objConnection.Close()
end sub
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
Dim objAdapter As SqlDataAdapter
Dim strSQLQuery As String
' Set up our connection.
objConnection = New SqlConnection("Data Source=(local); Initial Catalog=sigaf; user id=sa; password=sa159")
' Set up our SQL query text.
strSQLQuery = "sp_sRelacion_TableroControl_cNumDocum_Gas " & TxtNumDocumento.text
' Create new command object passing it our SQL query
' and telling it which connection to use.
objCommand = New SqlCommand(strSQLQuery, objConnection)
'abrimos la conexion
objConnection.open()
Dim rs As SqlDataReader = objCommand.ExecuteReader
rs.read
TxtAPaterno.text = rs("cApePaterno")
TxtAMaternotext = rs("cApeMaterno")
txtNombretext = rs("cNombres")
ddlday5.selectedvalue = day(rs("dFechaNacimiento"))
ddlmonth5.selectedindex = month(rs("dFechaNacimiento")) - 1
ddlyear5.selectedvalue = year(rs("dFechaNacimiento"))
ddlday2.selectedvalue = day(rs("dFechaVigDocCon"))
ddlmonth2.selectedindex = month(rs("dFechaVigDocCon")) - 1
ddlyear2.selectedvalue = year(rs("dFechaVigDocCon"))
ddlday4.selectedvalue = day(rs("dFechaSOAT"))
ddlmonth4.selectedindex = month(rs("dFechaSOAT")) - 1
ddlyear4.selectedvalue = year(rs("dFechaSOAT"))
objConnection.Close()
end sub