Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: WaLid
  Where is WaLid?
 Sidon
 Lebanon
 WaLid
 To: hicham Jabri
  Where is hicham Jabri?
 München
 Germany
 hicham Jabri
 Tags
Subject: RE: insert text more than 254 characters
Thread ID: 47668 Message ID: 47909 # Views: 12 # Ratings: 0
Version: Visual FoxPro 8 Category: Forms
Date: Thursday, July 29, 2004 2:50:36 PM         
   


Yes, you are right

The only way to avoid this, is to define a Parameter and Set its width to a higher value, like in this example

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim oConn As New OleDbConnection("Provider=VFPOLEDB.1;Data Source=c:\")
Dim oCMD As New OleDbCommand()
Dim longstr As String
Dim pad As Char
pad = Convert.ToChar("-")
longstr = "This is a Test Message"
longstr = longstr.PadRight(2124, pad)
With oCMD
.Connection = oConn
.Connection.Open()
.CommandType = CommandType.Text
.CommandText = "CREATE TABLE Test (code n(1), fldtest M)"
.ExecuteNonQuery()
.CommandText = "INSERT INTO Test VALUES (1,'A' )"
.ExecuteNonQuery()
.CommandText = "UPDATE Test SET FLDTEST = ? WHERE CODE=1"
.Parameters.Add("FLDTEST", OleDbType.Char, 10000).Value = longstr
.ExecuteNonQuery()
.Connection.Close()
End With
oConn.Close()
End Sub


> hi
> im using this from Vb.NET i have a form with texarea, and i tried to set in the table the field as Memo.
> my SQL statement looks like this :
> insert into mytable (myname, mytext) values ('Peter' , 'text....(the text is longer than 254 characters)')
> but it turns Error the same if i make update statement.
> im not using the command window i have website with VFP database.
> thank you
>
> > > hello i have form with text area, i save the content of the field in database, but the problem is when the length of the text area is more that 254 character it turns error. i chosed the type as memo and it's also not working, which field type should i chose for long textes ? if it's Memo so how i can make the statement to insert into this field ? thank you very much
> >
> > If you are doing it in code:
> >
> > REPLACE <memofield_name> WITH <long_text_string>
> > 

> >
> > If you have the field set as the ControlSource - you must use an EditBox (not a tetbox) and then no command is necessary.
> >
> > If you are using buffered tables, don't forget to TableUpdate() after the data has been entered.
> >
> >
> > Regards
> > Andy Kramek
> > Microsoft MVP (Visual FoxPro)
> > Akron, OH, USA
>
>
> you can share every thing but your ...


_________________________
Programmatically Yours
Walid Abu-zahr
Breathing FoxPro





COMPLETE THREAD

Tip: click here to scan for Windows Registry Errors and Optimize PC performance
insert text more than 254 characters Posted by hicham Jabri @ 7/26/2004 2:02:27 PM
RE: insert text more than 254 characters Posted by Andy Kramek @ 7/26/2004 3:20:30 PM
RE: insert text more than 254 characters Posted by hicham Jabri @ 7/27/2004 8:50:12 AM
RE: insert text more than 254 characters Posted by Walid @ 7/29/2004 2:50:36 PM