Link to home
Start Free TrialLog in
Avatar of designaire
designaireFlag for United States of America

asked on

Maximum character number in OleDbType.LongVarChar

Hi, I'm hoping I can use the program I just wrote to add more than 200 characters in an access database. It says you can use up to 6,000 which would be more than enough. Right now I can only get about 200. I read a article that using the below code should work, but it's not working. I have the access database field set to memo.


cmd.Parameters.Add("@description", OleDbType.LongVarChar, txtDescription.Text.Length, txtDescription.Text)

Open in new window

Avatar of designaire
designaire
Flag of United States of America image

ASKER

I don't have any problems when I update the field in the datagrid and add more characters. It just gives me an error message when I try to add to the database.
   openAccessConnection() 
Dim cmd As New OleDbCommand("insert into tblImg(dateorder,title,times,description,img_type,img_stream) values(@dateorder,@title,@times,@description,@img_type,@img_stream)", myAccessConnection)
                cmd.CommandType = CommandType.Text
                cmd.Parameters.Add("@dateorder", OleDbType.VarChar).Value = txtDateOrder.Text
                cmd.Parameters.Add("@title", OleDbType.VarChar).Value = txtDescription.Text
                cmd.Parameters.Add("@times", OleDbType.VarChar).Value = txtTimes.Text
                cmd.Parameters.Add("@description", OleDbType.LongVarChar, 6000).Value = txtDescription.Text
                'cmd.Parameters.Add("@description", OleDbType.LongVarBinary,  txtDescription.Text
 
                cmd.ExecuteNonQuery()
 
                closeAccessConnection()
                Response.Redirect("eventsEdit.aspx")
     

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found my error. I had one imput going to 2 fields. One of which was a text fiield and not a memo field.