Difference between same database.
hi, i am using a local database in c# visual studio and make a insert, delete and update record system for this i have created two database database 1 and database 2. In one form i use the database 1 and in another form i used database 2. My both database colums and data type values are same both have 4 coloums and have same name in it. The problem is that when i insert a record in one form which means that in database 1 it automatically inserted into database 2 and same for all other 2 operations( delete and update). Please tell me how can i solve this so that i am very thank full to you
Guest UserPosted Jul 12, 2014, 10:17 PM
DBConn_SI
&
DBConn
Please paste code for DBConn_SI.drugInsert_SI & DBConn.drugInsert
Wajid UsmanPosted Jul 11, 2014, 6:06 AM
yaa sure i paste my source code of form 1 and form 2 both.
thanks sumit for help :)
Source Code form 1 (Insert):
private void btninsert_Click(object sender, EventArgs e)
{
if (txtparticular.Text.Length > 0 && txtquantity.Text.Length > 0)
{
int k = DBConn_SI.drugInsert_SI(txtparticular.Text, Int32.Parse(txtquantity.Text), Int32.Parse(txtrate.Text), DateTime.Parse(txtdatetime.Text));
if (k > 0)
{
dgvDrugs_SI.DataSource = DBConn_SI.getAllDrugs();
}
else
{
MessageBox.Show("No record inserted");
}
}
else
{
MessageBox.Show("Please fill in ID and Name of the drug");
}
Source Code of form 2 (Insert):
private void btninsert_Click(object sender, EventArgs e)
{
if (txtparticu.Text.Length > 0 && txtquanti.Text.Length > 0)
{
int k = DBConn.drugInsert(txtparticu.Text, Int32.Parse(txtquanti.Text), Int32.Parse(txtrate.Text), DateTime.Parse(txtdatetime.Text));
if (k > 0)
{
dgvDrugs.DataSource = DBConn.getAllDrugs();
}
else
{
MessageBox.Show("No record inserted");
}
}
else
{
MessageBox.Show("Please fill in ID and Name of the drug");
}
}
Guest UserPosted Jul 10, 2014, 9:07 PM
Anyway, ideally it's not possible that query fired over 1 db inserts record into other db. It's very strange. Can you please paste code for any operation say Insert?
twitter @sumitjolly