Home > Software engineering >  About VC 6.0 to character limit insert into data in the database
About VC 6.0 to character limit insert into data in the database

Time:10-03

I use ODBC to insert into data in SQL server 2000, but the results can only insert into 256 characters, the following code
CDatabase m_dbAgent;
Cstrings STR, SQL;
M_dbAgent. OpenEx (DSN="yidong; UID=sa; The PWD=ilo2016 ");
SQL="insert into dbo. Test (Col001) values ('";
SQL +="1 aaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc \
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDCCCCDDCCCCDDCCCCDDCCCCDDCCCCDDCCCCCCCCCCCD \
Ddcccccccccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2 ";
SQL +="')";
M_dbAgent. The ExecuteSQL (SQL);//1, 2 end

Results only 256 characters written into the database, database table corresponding field is varchar, 8000 characters, the method of using ODBC and ADO, are so, somehow, which devoted warrior please help, thanks a lot,
But the same insert statement in the query analyzer test is no problem,

CodePudding user response:

If vc write varchar columns, only 256 characters, online, etc

CodePudding user response:

AfxMessageBox (SQL);//check the SQL statement is correct
M_dbAgent. The ExecuteSQL (SQL);

CodePudding user response:

refer to the second floor worldy response:
afxMessageBox (SQL);//check the SQL statement is correct
M_dbAgent. The ExecuteSQL (SQL);


refer to the second floor worldy response:
afxMessageBox (SQL);//check the SQL statement is correct
M_dbAgent. The ExecuteSQL (SQL);


refer to the second floor worldy response:
afxMessageBox (SQL);//check the SQL statement is correct
M_dbAgent. The ExecuteSQL (SQL);


There are no more questions, to be closing in on 2

CodePudding user response:

refer to the second floor worldy response:
afxMessageBox (SQL);//check the SQL statement is correct
M_dbAgent. The ExecuteSQL (SQL);


There are no more questions, to be closing in on 2


Use afxMessageBox print SQL string displayed is no problem, but written to the database is out of the question,

CodePudding user response:

reference 1st floor recurtonet response:
is vc write varchar columns, only 256 characters, such as online


If the SQL tool can write more than 256 characters, VC should not only enter 256 characters
You database field for other types

CodePudding user response:

reference 5 floor worldy reply:
Quote: refer to 1st floor recurtonet response:

If vc write varchar columns, only 256 characters, such as online


If the SQL tool can write more than 256 characters, VC should not only enter 256 characters
Database field you change other type to see


In several related to character types, if still won't do,

CodePudding user response:

GetODBCFieldInfo view information
The ALTER TABLE tableName ADD columnName varchar (1024), insert a column, then the column operation try

CodePudding user response:

Don't want to do a BLOB types of data access, so too much trouble, where should be 256 limit, who know tell a doctor, thank you.

CodePudding user response:

refer to 7th floor zgl7903 response:
GetODBCFieldInfo view information
The ALTER TABLE tableName ADD columnName varchar (1024), insert a column, then the column operation try

Ok, today's free to try, thanks a lot,

CodePudding user response:

In the real world, in addition to the time and space could be infinite, any other things are limited,

CodePudding user response:

Check m_dbAgent. The ExecuteSQL (SQL); This function implementation, its internal has made truncation?
  • Related