DbConnectionStringBuilder connectionStringBuilder = new
DbConnectionStringBuilder(false);
connectionStringBuilder.ConnectionString =
DataBaseCreator.connectString;
if (!connectionStringBuilder.ContainsKey("Provider"))
throw new KeyNotFoundException("Provider");
DbProviderFactory factory =
DbProviderFactories.GetFactory(connectionStringBuilder["Provider"].ToString());
using (DbConnection connection = factory.CreateConnection())
{
connection.ConnectionString = DataBaseCreator.connectString;
connection.Open();
DataTable target = new DataTable();
//创建DataAdapter
DbDataAdapter dataAdapter = factory.CreateDataAdapter();
dataAdapter.SelectCommand = factory.CreateCommand();
dataAdapter.SelectCommand.Connection = connection;
dataAdapter.SelectCommand.CommandText = "Select * FROM
test";
DbCommandBuilder builder = factory.CreateCommandBuilder();
builder.DataAdapter = dataAdapter;
dataAdapter.InsertCommand = builder.GetInsertCommand();
dataAdapter.UpdateCommand = builder.GetUpdateCommand();
dataAdapter.DeleteCommand = builder.GetDeleteCommand();
dataAdapter.Fill(target);
Assert.AreEqual<int>(10, target.Rows.Count);
target.Rows[0]["name"] = "modified";
dataAdapter.Update(target);
}
--
View this message in context:
http://www.nabble.com/bug-of-Guid-When-use-dbcommandbuilder-t1268418.html#a3835334
Sent from the firebird-net-provider forum at Nabble.com.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider