L
Loogie
I am trying to write some code to see if a table of a certain name does
not exist then it is to be created. However I am getting the following
error message:
system.InvalidOperationException was unhandled
Message="SQL Server Mobile Edition does not support calls to HasRows
property if the underlying cursor is not scrollable."
Here is my code:
Dim sqlSeek As New SqlCeCommand("SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'products' AND TABLE_TYPE = 'TABLE'", ssceconn)
Dim sqlCreateTable As SqlCeCommand = ssceconn.CreateCommand()
Dim reader As SqlCeDataReader = sqlSeek.ExecuteReader()
If reader.HasRows = False Then
' Create product table
sqlCreateTable.CommandText = "CREATE TABLE product(p_item int
IDENTITY(1,1) PRIMARY KEY NOT NULL, p_code NVARCHAR(1) NOT NULL, p_name
NVARCHAR(255) NOT NULL, p_min numeric(2) NOT NULL, p_top numeric(2) NOT
NULL, p_len numeric(2) NOT NULL, p_lcl NUMERIC(2) NULL, p_ucl NUMERIC(2)
NULL, p_units NVARCHAR(7) NULL, p_speclist NVARCHAR(100) NOT NULL,
p_notes NVARCHAR(255) NULL, p_verify NVARCHAR(3) NULL)"
sqlCreateTable.ExecuteNonQuery()
End If
How do I fix this? I am assuming I have encountered a non-supported
feature of the .net compact framework
I am using VB.Net 2005 CF
All help appreciated.
:L
not exist then it is to be created. However I am getting the following
error message:
system.InvalidOperationException was unhandled
Message="SQL Server Mobile Edition does not support calls to HasRows
property if the underlying cursor is not scrollable."
Here is my code:
Dim sqlSeek As New SqlCeCommand("SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'products' AND TABLE_TYPE = 'TABLE'", ssceconn)
Dim sqlCreateTable As SqlCeCommand = ssceconn.CreateCommand()
Dim reader As SqlCeDataReader = sqlSeek.ExecuteReader()
If reader.HasRows = False Then
' Create product table
sqlCreateTable.CommandText = "CREATE TABLE product(p_item int
IDENTITY(1,1) PRIMARY KEY NOT NULL, p_code NVARCHAR(1) NOT NULL, p_name
NVARCHAR(255) NOT NULL, p_min numeric(2) NOT NULL, p_top numeric(2) NOT
NULL, p_len numeric(2) NOT NULL, p_lcl NUMERIC(2) NULL, p_ucl NUMERIC(2)
NULL, p_units NVARCHAR(7) NULL, p_speclist NVARCHAR(100) NOT NULL,
p_notes NVARCHAR(255) NULL, p_verify NVARCHAR(3) NULL)"
sqlCreateTable.ExecuteNonQuery()
End If
How do I fix this? I am assuming I have encountered a non-supported
feature of the .net compact framework
I am using VB.Net 2005 CF
All help appreciated.
:L