The code below generates the indicated error. As a newbie to vb and SQL I
have no idea how to track this down. I did verify that the connection state
is open. My suspicion is that I have to connect to a seperate "sysobjects "
database???
THE CODE:
Dim oSQLConnection As New SqlConnection(" data source =" _
& "psi-sbs2k3 ;" _
& "initial catalog = 'JHH PRODUCT DATA' ;" _
& "Integrated Security=SSPI;" _
& "persist security info =True;")
oSQLConnection. Open()
Dim osqlCommand As New SqlCommand("if exists (select * from
dbo.sysobjects where id = object_id(N'[dbo].[dsdprod]') and
OBJECTPROPERTY( id, N'IsUserTable') = 1)" _
& " drop table [dbo].[dsdprod] ")
osqlCommand.Exe cuteNonQuery()
ERROR GENERATED IS...
An unhandled exception of type 'System.Invalid OperationExcept ion' occurred
in system.data.dll
Additional information: ExecuteNonQuery : Connection property has not been
initialized.
have no idea how to track this down. I did verify that the connection state
is open. My suspicion is that I have to connect to a seperate "sysobjects "
database???
THE CODE:
Dim oSQLConnection As New SqlConnection(" data source =" _
& "psi-sbs2k3 ;" _
& "initial catalog = 'JHH PRODUCT DATA' ;" _
& "Integrated Security=SSPI;" _
& "persist security info =True;")
oSQLConnection. Open()
Dim osqlCommand As New SqlCommand("if exists (select * from
dbo.sysobjects where id = object_id(N'[dbo].[dsdprod]') and
OBJECTPROPERTY( id, N'IsUserTable') = 1)" _
& " drop table [dbo].[dsdprod] ")
osqlCommand.Exe cuteNonQuery()
ERROR GENERATED IS...
An unhandled exception of type 'System.Invalid OperationExcept ion' occurred
in system.data.dll
Additional information: ExecuteNonQuery : Connection property has not been
initialized.
Comment