Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/07/2010, 12:38
pier_cajo
 
Fecha de Ingreso: junio-2010
Mensajes: 6
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: validar myReader.read()

hola alebam esto te puede ayudar mucho lo utilizo para crear nuevos codigos

Dim CN As New SqlConnection("DATA SOURCE=PIER\SQLSERVER2005;USER ID=SA;PWD=;DATABASE=base")
Dim SQL As String
SQL = "SELECT MAX(COD_CLIENTE)FROM CLIENTE"
Dim CMD As New SqlCommand
Dim DR As SqlDataReader
CMD.CommandType = CommandType.Text
CMD.Connection = CN
CMD.CommandText = SQL
CN.Open()
DR = CMD.ExecuteReader
DR.Read()
If IsDBNull(DR.Item(0)) Then
TextBox1.Text = Format(1, "00000")
Else
TextBox1.Text = Format(CType(DR.Item(0), Integer) + 1, "00000")
End If
CN.Close()

espero te sirva de ayuda