Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Maximum character number in OleDbType.LongVarChar

Posted on 2009-05-10
3
Medium Priority
?
2,509 Views
Last Modified: 2012-08-13
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

0
Comment
Question by:designaire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:designaire
ID: 24349805
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

0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 375 total points
ID: 24352360
According to this MSDN article,

http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbtype.aspx

LongVarChar translates to String. String can hold unlimited number of characters (depending on available memory). What is the column size in database and what is the exact text of the error message?
0
 

Author Comment

by:designaire
ID: 24353762
I found my error. I had one imput going to 2 fields. One of which was a text fiield and not a memo field.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question