Home > Back-end >  How to write the data in the database in C builder
How to write the data in the database in C builder

Time:10-19

How to write the data in the database, in c + + builder through ADO operation

CodePudding user response:

Adoquery connected to the adoconnection,
Adoquery - & gt; Append ();
Adoquer - & gt; FieldByName (" fieldName ") - & gt; Value=https://bbs.csdn.net/topics/... ;
Adoquery - & gt; Post ();
Can also perform the insert statement to write data
What do you want

CodePudding user response:

 
DBQuery - & gt; Close ();
DBQuery - & gt; SQL - & gt; The Clear ();
DBQuery - & gt; SQL - & gt; Text=strSQL;
DBQuery - & gt; The Open ();

DBQuery - & gt; Append ();//add a new record
for (int i=0; I & lt; FldTotal; I++)
{
The switch (fldType [I])
{
Case 0://integer
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsInteger=StrToInt (fldEdit [I]);
break;
Case 1://floating-point
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsFloat=StrToFloat (fldEdit [I]);
break;
Case 2://character
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsString=fldEdit [I];
break ;
Case 3: type//date
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsDateTime=StrToDateTime (fldEdit [I]);
break;
}
}
DBQuery - & gt; Post ();

DBQuery - & gt; Close ();

CodePudding user response:

If it is a field, a field to write, do it according to the second floor,
If it is to write a SQL statement, no return value, for example "insert into ExecSQL directly;

CodePudding user response:

2, 4 floor of positive solutions

CodePudding user response:

Google once, you know,,,

CodePudding user response:

refer to the second floor cptang response:
 
DBQuery - & gt; Close ();
DBQuery - & gt; SQL - & gt; The Clear ();
DBQuery - & gt; SQL - & gt; Text=strSQL;
DBQuery - & gt; The Open ();

DBQuery - & gt; Append ();//add a new record
for (int i=0; I & lt; FldTotal; I++)
{
The switch (fldType [I])
{
Case 0://integer
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsInteger=StrToInt (fldEdit [I]);
break;
Case 1://floating-point
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsFloat=StrToFloat (fldEdit [I]);
break;
Case 2://character
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsString=fldEdit [I];
break ;
Case 3: type//date
DBQuery - & gt; Fields - & gt; Fields + fldStart [I] - & gt; AsDateTime=StrToDateTime (fldEdit [I]);
break;
}
}
DBQuery - & gt; Post ();

DBQuery - & gt; Close ();
  • Related