|
private void yflsDataBind ()
{
// conndata ();
// SqlConnection con = new SqlConnection ("server = 192.168.23.212; database = databank; uid = sa; pwd = 123456");
try
{
con.Open ();
SqlDataAdapter yfwd = new SqlDataAdapter ("select yfdb.wendu as dbwd, yfzb.wendu as zbwd from yfdb, yfzb where yfdb.ID = yfzb.ID", con);
DataSet wd = new DataSet ();
yfwd.Fill (wd, "yfwd");
// Binding data to the DataGridView
// Requires receiving window creation. . .
MyInvoke wdInvoke = new MyInvoke (yfwdBindDataGridView);
this.BeginInvoke (wdInvoke, new object [] {wd});
}
I take the data from the database, and then put it into another database, I want the data in yfwd, ds.Tables
["yfls"]. Rows [0] ["ID"]
["yfls"]. Rows [0] ["lasu"]
["yfls"]. Rows [0] ["wendu"]
["yfls"]. Rows [0] ["DateTime"]
Put into another table, the basic structure of the target is the same, but the ID column should be automatically generated instead of stored in the database.
// SqlConnection con = new SqlConnection ("server = 192.168.35.115; database = LZdata; uid = sa; pwd = 123456");
// The database is different but the tables are the same, how to write next ---------------------------------- ----,
How should I save las, wendu, and DateTime of yfls to the yf table of LZdata as historical data? The ID of yfls is unchanged (he is an operation to update a row), so it cannot be inserted directly into the yf table. I can only ask for his last three columns |
|