0
OdbcConnection conn = new OdbcConnection(@"Dsn=ani;dbq=D:\anita\inventory\chemicals.accdb;defaultdir=D:\anita\inventory;driverid=25;fil=MS Access;maxbuffersize=2048;pagetimeout=5;uid=admin");
String CommandText = "INSERT INTO SupplierDetails (ID, Supplier, Company, Address, State, Country, Pincode, PhoneNo, MobileNo, Email, Fax, RawMaterials, Note) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
conn.Open();
OdbcCommand exe = new OdbcCommand(CommandText, conn);
exe.Parameters.Add("@ID", OdbcType.VarChar, 10).Value = TextBox3.Text;
exe.Parameters.Add("@Supplier", OdbcType.VarChar, 50).Value = TextBox4.Text;
exe.Parameters.Add("@Company", OdbcType.VarChar, 50).Value = TextBox1.Text;
exe.Parameters.Add("@Address", OdbcType.VarChar, 50).Value = TextBox11.Text;
exe.Parameters.Add("@State", OdbcType.VarChar, 20).Value = TextBox2.Text;
exe.Parameters.Add("@Country", OdbcType.VarChar, 20).Value = TextBox5.Text;
exe.Parameters.Add("@Pincode", OdbcType.VarChar, 15).Value = TextBox10.Text;
exe.Parameters.Add("@PhoneNo", OdbcType.VarChar, 15).Value = TextBox6.Text;
exe.Parameters.Add("@MobileNo", OdbcType.VarChar, 15).Value = TextBox7.Text;
exe.Parameters.Add("@Email", OdbcType.VarChar, 15).Value = TextBox8.Text;
exe.Parameters.Add("@Fax", OdbcType.VarChar, 15).Value = TextBox9.Text;
exe.Parameters.Add("@RawMaterials", OdbcType.VarChar, 50).Value = TextBox12.Text;
exe.Parameters.Add("@Note", OdbcType.VarChar, 50).Value = TextBox13.Text;
exe.ExecuteNonQuery();
4

0 回答 0