Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

256 byte limit on SQL strings 1

Status
Not open for further replies.

TomSnider

Programmer
May 2, 2001
27
US
I am starting a new thread on the problem of a string being truncated to 256 chars when used in an 'opendataset' method. I really need to find out how to get a string longer than 256 to be processed. I have a database DB, a recordset RS and a string sSQL. sSQL is assigned from a multi-line text box. I then execute a command db.openrecordset(sSQL). If the len(sSQL) <= 256, then the query is executed correctly.....if the len(sSQL) > 256, then I get various errors telling me that I have an invalid SQL statement. In the error message, it shows the sql statement that it thinks I sent it....however, it is always truncated after character 256. Maybe this is truncated sql statement is due to the MsgBox statement used to show the error.....but in all cases, if the len(sSQL) > 256, then I get errors......What am I missing.....surely, 256 characters is not a limit on a string for an SQL statement. Any help would make me crazy with happiness!

 
Best bet? I'd use ADO if I were you...

Go to Project->References and include Microsoft ActiveX Data Objects 2.x library.

to retrieve a recordset:

dim cnnConnection as new adodb.Connection
dim rstRecordset as new adodb.Recordset

cnnConnection.ConnectionString = &quot;<connectionstring>&quot;
cnnConnection.Open

rstRecordset.Open &quot;Sql Statement Line 1 &quot; & _
&quot;Sql Statement line 2 &quot; & _
&quot;Sql Statement line 3 &quot;, cnnConnection


I've used HUGE Sql statements w/ ADO and never had a problem.. It tends to be a lot better than DAO anyways.

Just a suggestion.

--NipsMG
 
I've hesitated to make the jump to ADO, because I was worried about the app running on older WIN98 machines. I don't know if they all have to have updated MS software or not. Do I have any worries on that regard?
 
Well,

An equivalent or higher version of MDAC must be installed on the target machine... However.. If you use the Package and Deployment wizard in Programs-> Microsoft Visual Studio 6.0-> icrosoft Visual Studio 6.0 Tools folder, you can create a setup program which will automically include AND install the required version of Data Access Components on the target computer during installation..

If you don't have the Package and Deployment wizard on your computer, just download the latest version of MDAC from Microsoft, and include it with the software, installing it on target machines before your program is run.

Hope this answers your question.

NipsMG
 
Thanks much for the help. I will go ahead and change this app to use ADO....it should not be a big deal....here goes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top