Home > database >  PB getitemstring ()
PB getitemstring ()

Time:09-23

My code automatically generated data table is as follows:
String ls_SQL_1, ls_errors
String ls_1
Int I
For I=1 to dw_1. Rowcount ()
Ls_1=dw_1. Getitemstring (I, 0)
//IF Len (ls_errors) & gt; 0 THEN
//MessageBox (" error ", "SyntaxFromSQL () error:" + ls_errors)
//RETURN
//END IF
Ls_SQL_1=ls_SQL_1 + ls_1 + 'integer null, ~ r ~ n'
End for
String ls_sql="if (object_id (' PJNR ') is not null) drop table PJNR"
The execute immediate: ls_sql;
Ls_SQL_1="CREATE TABLE PJNR" + & amp;
"(no. Char (12) not null, PRIMARY KEY" + & amp;
"The name char (12) not null," + & amp;
Ls_sql_1 + & amp;
"Overall numeric (3) the not null)"
The EXECUTE IMMEDIATE: ls_SQL_1 USING sqlca;
commit;
If the sqlca. Sqlcode<> 0 then
Messagebox (" ", "fail")
The else
Messagebox (" ", "success")
End the if
Disconnect;
The connect.
If the sqlca. Sqlcode<> 0 then
Messagebox (" prompt ", "database connection error, please try again after checking!" , stopsign!)
The else
Messagebox (" prompt ", "database have connection again!" , information!
End the if

Runtime error, show as follows:
Error: the DataWindow colunm type dosed the not match the GetItem type at line 5 at clicked event of object cb_1 of w_zbgl.


Thought is to read the data sheet of the data type of the problem, but changed many times, are equally wrong, used numeric, decimal and char, cannot solve the problem, please give directions!

CodePudding user response:

Grammar:
String dwcontrol. GetItemString (long row, an integer column {, DWBuffer DWBuffer, Boolean originalvalue})

CodePudding user response:

There is something wrong with the fifth line of code
Ls_1=dw_1. Getitemstring (I, 0)

The second parameter should be column name in brackets, and using quotation marks,

CodePudding user response:

Ls_1=dw_1. Getitemstring (I, 0) to ls_1=dw_1. Getitemstring (I, 2) after can run smoothly, but reading is the second column of the data, with 0 or 1 is wrong, but I will read the first column of data, how to change?

CodePudding user response:

The first column of the data types not char/varchar
If it is a data type getitemnumber ()
The date type getitemdatetime ()

CodePudding user response:

The first and second column data type is char

CodePudding user response:

refer to the second floor response:
there is something wrong with the line of code v
Ls_1=dw_1. Getitemstring (I, 0)

The second parameter should be column name in brackets, and using quotation marks,

Should be 0, into a "column_name" column

CodePudding user response:

Ls_1=dw_1. Getitemstring (I, 0)
Function getitemstring the second parameter should be column name, and use quotation marks to
Look at the PB help, there is a example

CodePudding user response:

I have tried your method above, or not, an error occurred when the run after changing the column name, error is the beginning of the
Error: the DataWindow colunm type dosed the not match the GetItem type at line 5 at clicked event of object cb_1 of w_zbgl

CodePudding user response:

The column data type is character?

CodePudding user response:

B: yes, so think impassability, char, why can read the second column, but could not read the first column
  • Related