fueron 1 par d pasos ...pero lo use usando 1 storedprocedure
y ahi cree las validaciones
Cita: sub validacionesautomaticas()
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
Dim objAdapter As SqlDataAdapter
Dim strSQLQuery As String
dim a1 as integer
' Set up our connection.
objConnection = New SqlConnection("Data Source=(local); Initial Catalog=sigaf; user id=sa; password=sa159")
' Set up our SQL query text.
if request.Form("DdlTipoCredito") = "" then
a1 = 1
else
a1 = request.Form("DdlTipoCredito")
end if
strSQLQuery = "select nTipoCredito,cDescripcion,nNumBancosEndeuda,nAñoFa brica,nLimiteEndeuda from tipocredito where nTipoCredito =" & a1
' 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
nNumBancosEndeuda = rs("nNumBancosEndeuda")
AnoFabrica = rs("nAñoFabrica")
nLimiteEndeuda = rs("nLimiteEndeuda")
rgvNBancos.MaximumValue = nNumBancosEndeuda
rgvAnoFabri.MaximumValue = AnoFabrica
rgvTotEndeuda.MaximumValue = nLimiteEndeuda
objConnection.Close()
end sub