The program code is as follows:
The application of the open () :
The SQLCA. DBMS="ODBC"
The SQLCA. The AutoCommit=False
The SQLCA. DBParm="ConnectString='DSN=student'"
Connect using the sqlca;
If the sqlca. Sqlcode<0 then
Messagebox (" connection ", "the reason for failure:" + sqlca. Sqlerrtext, stopsign!)
The halt close
End the if
Open (w_main)
The application of the close () :
Disconnect the using the sqlca;
If the sqlca. Sqlcode<0 then
Messagebox (" disconnect "failure," the reason for failure: "+ sqlca. Sqlerrtext, stopsign!)
The halt close
End the if
Creates a data window object: dw_stu, which comes from the three tables, students table. The name, the class schedule. Course name, course selection table. The score
Create a window in which to insert a data window controls, and its DataObject attribute is set to dw_stu
Declare an instance variable in the window: string oldsql
Window in the open event code is as follows:
Oldsql="select name, course name and table from students join course selection table on the student table. Student id=course selection table. Student id joins the curriculum on course selection table. Course number=class schedule. Courses,"
Dw_1. SetTransobject (sqlca)
Dw_1. Retrieve ()
Insert a button in the window, used to display all the records, the code is as follows:
Dw_1. Setsqlselect (oldsql)
Dw_1. Retrieve ()
here's the problem, after running the program, click the button, will pop up an error message dialog:
Select error: sqlstate=22005 [Microsoft] [odbc SQL server driver] for modelling shows invalid character values
Please help to see what's the problem?
CodePudding user response:
The field name and the name of the table had better use English is better,,,CodePudding user response:
The same operation, on the other computer and there is no problem?CodePudding user response:
I also met, first, make sure you list is consistent with the database table field type, and parameters of what there is no problem, or tips,Change your code to the following:
The SQLCA. DBParm="ConnectString='DSN=student, DisableBind=1, StaticBind=0, CallEscape=' No ', DelimitIdentifier='Yes', StripParmNames=' Yes'"