SQL - Error al visualizar registros cargados en la tabla

 
Vista:
sin imagen de perfil
Val: 40
Ha mantenido su posición en SQL (en relación al último mes)
Gráfica de SQL

Error al visualizar registros cargados en la tabla

Publicado por Miguel (26 intervenciones) el 04/02/2023 18:16:12
Miren tengo este código que he conseguido que funcione.

Public Function Crear() As Boolean
Dim Result As Boolean = False
Using Conn As New SqlConnection(Conexion.ConnectionString)
Try
Conn.Open()
Using Cmd As New SqlCommand
Cmd.CommandText = "IF EXISTS (Select * From sysobjects Where type='U' and name='Etiquetas') BEGIN DROP TABLE Etiquetas END
CREATE TABLE dbo.Etiquetas
(IdEtiqueta Int IDENTITY(1,1),
Nombre varchar(40) not null,
Calle varchar(40) not null,
Cp char(5) not null,
Municipio varchar(40) not null,
Provincia varchar(22) not null)

INSERT INTO Etiquetas(Nombre,Municipio,Cp,Provincia,Calle) " +
"SELECT T.Nombre,M.Municipio,R.Cp,P.Provincia,C.Calle FROM Clientes T " +
"INNER JOIN Municipios M ON T.IdCp = M.IdCp " +
"INNER JOIN Municipios R ON T.IdCp = R.IdCp " +
"INNER JOIN Provincias P ON LEFT(T.IdCp,2) = P.IdProv " +
"INNER JOIN Calles C ON T.IdCalle = C.IdCalle "
Cmd.CommandType = CommandType.Text
Cmd.Connection = Conn
Dim Ok As Int16 = Cmd.ExecuteNonQuery
If Ok = 0 Then
Throw New Exception("Se produjo un error al Crear las Etiquetas ó al Insertar los registros")
End If
Result = True
End Using
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Using
Return Result
End Function

Pero ahora me encuentro que están cargado los registros que cumplen la condición y sin embargo me da un mensaje de que la tabla está sin datos.

Pueden ayudarme a aclarar esto pues me he quedado sin ideas de cual es la causa ahora.

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder