I have a 2 richtext boxes (txtDesc and txtAction) and I am trying to insert the content into a SQL database table using a stored procedure.
Below is the vb.net code that I am using.
The stored procedure looks like this:
And the table looks like the attached image.
When I run the stored procedure I get this error "An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll" I can only assume that this error is being produced when trying to insert the information into the text fields of the table.
I have never tried to insert information into a text field before so I can guess that I am doing something wrong, could someone please have a look and let me know where I have made the error.
Thank you
Simon
Below is the vb.net code that I am using.
Code:
Dim myInsertCmd As New OleDb.OleDbCommand("spInsertComm")
myInsertCmd.CommandType = CommandType.StoredProcedure
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commTag", OleDb.OleDbType.VarChar)).Value = strTag
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commTitle", OleDb.OleDbType.VarChar)).Value = strTitle
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commDisp", OleDb.OleDbType.VarChar)).Value = strDisp
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commType", OleDb.OleDbType.VarChar)).Value = strType
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commDate", OleDb.OleDbType.VarChar)).Value = strDeadline
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commArea", OleDb.OleDbType.VarChar)).Value = strArea
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commModRef", OleDb.OleDbType.VarChar)).Value = strModRef
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commOrig", OleDb.OleDbType.VarChar)).Value = strOrig
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commDesc", OleDb.OleDbType.VarChar)).Value = strDesc
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commAction", OleDb.OleDbType.VarChar)).Value = strAction
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@commCreated", OleDb.OleDbType.VarChar)).Value = strDateTime
myInsertCmd.Parameters.Add(New OleDb.OleDbParameter("@projName", OleDb.OleDbType.VarChar)).Value = MRCSData.Instance.ProjectName
The stored procedure looks like this:
Code:
CREATE PROCEDURE [dbo].[spInsertComm] @commTag as varChar(255), @commTitle as varchar(255), @commDisp as varchar(255),
@commType as varchar(255), @commDate as varchar(25), @commArea as varchar(100), @commModRef as varchar(100),
@commOrig as varchar(100), @commDesc as text, @commAction as text, @commCreated as varchar(50), @projName as varchar(100)
AS
INSERT INTO commentTbl (commTag,commTitle,commDisp,commType,commDate,commArea,commModRef,commOrig,commDesc,
commAction,commCreated,commHistory,projName) VALUES (@commTag,@commTitle,@commDisp,@commType,
@commDate,@commArea,@commModRef,@commOrig,@commDesc,@commAction,@commCreated,No,
@projName)
GO
And the table looks like the attached image.
When I run the stored procedure I get this error "An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll" I can only assume that this error is being produced when trying to insert the information into the text fields of the table.
I have never tried to insert information into a text field before so I can guess that I am doing something wrong, could someone please have a look and let me know where I have made the error.
Thank you
Simon