Home > Net >  C # SQLiteDataAdapter Fill the DataSet when the column type according to their values implicit trans
C # SQLiteDataAdapter Fill the DataSet when the column type according to their values implicit trans

Time:03-09

When using SQLiteDataAdapter, I use the Fill method to populate a new DataSet, one of value is the id card, when the first data for pure digital id does not contain X, method of this column will automatically from the String (LONG VARBINARY) type into Int64 type, but if I will be the first data id to contain the value of X, there is no this problem, can you tell me this implicit conversion to how to avoid?
PS: the confirmed data table structure is correct, is also a string is a string, the import data

 SQLiteDataAdapter sda=new SQLiteDataAdapter (CMD); 
The DataSet ds=new DataSet ();
Sda. The Fill (ds);

CodePudding user response:

//dataadapters can directly fill the DataTable, define the DataTable column, explicitly specify column data types, 
The DataTable table=new DataTable ();
Table. The Columns. The Add (" v1 ", typeof (double));
Table. The Columns. The Add (" v2 ", typeof (string));
Sda. The Fill (table)

CodePudding user response:

reference 1/X - I - n reply:
//dataadapters can directly fill the DataTable, define the DataTable column, explicitly specify column data types, 
The DataTable table=new DataTable ();
Table. The Columns. The Add (" v1 ", typeof (double));
Table. The Columns. The Add (" v2 ", typeof (string));
Sda. The Fill (table)

Thank you, could you tell me whether the CommandText to enumerate one by one, according to the column definition here and can't use the SELECT * FROM?

CodePudding user response:

Datatable columns of data, SQL statements don't need,
  •  Tags:  
  • C#
  • Related