با سلام و خسته نباشید
من تو #C یه برنامه نوشتم که فاکتور خرید داره
حالا من یه گرید ویو گذاشتم که کاربر تو برنامه وقتی محصولات رو انتخاب میکنه کد محصول و... میره تو گرید ویو داخل صفحه نمایش داده میشه
سوال من اینه ک چطور میتونم اون اطلاعاتی که داخل گرید ویو هستش رو تو جدول فاکتور در دیتابیس ذخیره کنم ؟ ممنون میشم راهنمایی کنید.
اینم عکس گرید ویویی ک میخوام ذخیره بشه
این لینک رو ببینید
ممنون آقای مدائنی ولی این کد بدرد من نمیخوره
اگه میشه بگین ک چطور اطلاعات داخل گرید ویو رو تو دیتابیس ذخیره کنم ممنون
if (dataGridView1.CurrentRow != null) { OleDbConnection con = new OleDbConnection(Connection); OleDbCommand com = new OleDbCommand("Insert Into Table1 (name,lastname,coname,handinto,handindate,handoverto,unit,parcelrecieve,Description) Values (@name,@lastname,@coname,@handinto,@handindate,@handoverto,@unit,@parcelrecieve,@Description)", con); com.Parameters.AddWithValue("@name", dataGridView1.CurrentRow.Cells[0].Value.ToString()); com.Parameters.AddWithValue("@lastname", dataGridView1.CurrentRow.Cells[1].Value.ToString()); com.Parameters.AddWithValue("@coname", dataGridView1.CurrentRow.Cells[2].Value.ToString()); com.Parameters.AddWithValue("@handinto", dataGridView1.CurrentRow.Cells[3].Value.ToString()); com.Parameters.AddWithValue("@handindate", dataGridView1.CurrentRow.Cells[4].Value.ToString()); com.Parameters.AddWithValue("@handoverto", dataGridView1.CurrentRow.Cells[5].Value.ToString()); com.Parameters.AddWithValue("@unit", dataGridView1.CurrentRow.Cells[6].Value.ToString()); com.Parameters.AddWithValue("@parcelrecieve", dataGridView1.CurrentRow.Cells[7].Value.ToString()); com.Parameters.AddWithValue("@Description", dataGridView1.CurrentRow.Cells[8].Value.ToString()); con.Open(); com.ExecuteNonQuery(); con.Close(); }
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)