Just getting started using SSce and having a few problems
What I want to do is something like this...
Dim Code As Integer Dim Description As String = txtDescription.Text.Trim Dim conn As SqlCeConnection = ConnectToLocalDatabase() Dim ssql As New System.Text.StringBuilderssql.AppendLine(
"INSERT INTO T_Titles (Description)")ssql.AppendLine(
"VALUES(@Description)")ssql.AppendLine(
"SELECT @Code = @@IDENTITY") Dim cmd As New SqlCeCommand(ssql.ToString, conn) Dim sqlCode As New SqlCeParameter("@Code", 0)sqlCode.Direction = ParameterDirection.InputOutput
cmd.Parameters.Add(sqlCode)
cmd.Parameters.Add(
New SqlCeParameter("@Description", Description))cmd.ExecuteNonQuery()
Code =
CInt(sqlCode.Value)**********************************************************************
The above code doesnt work. Firstly I am not sure if I can execute the two statements in one go. Secondly, I am not sure if output parameters are supported.
I have been working with SQL Server since 6.5 but have always used sprocs and am feeling a little lost here without them. Any help getting started would be greatly appreciated.
Thanks