Hi guys i have problem
I need to update data in tables without using button i want only using textbox changed event
FleetManagment.Fleet fleet1 = new FleetManagment.Fleet();
string a = fleet1.UpdateDriver("Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "", Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text);
MessageBox.Show("Record changed successfully");
fillcontrol();
string a = fleet1.UpdateDriver("Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "", Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text);
MessageBox.Show("Record changed successfully");
fillcontrol();
but problem when i load the data using load event
or press on next navigation button it give me same message box
How i make this message "Record changed successfully" shown only when update record and not show when browsing records or incresing
SUNIL GUTTAPosted Feb 1, 2014, 12:10 AM
Actually code can be way way better and reused in much better way ..
Anyways look in this attachment fixed bugs going by ur path
Regards
----------------------RATE THE SOLUTION IF YOU FEEL IT DESERVES---------------------
SUNIL GUTTAPosted Feb 1, 2014, 5:07 AM
ahmed saPosted Feb 1, 2014, 3:34 AM
ahmed saPosted Jan 31, 2014, 8:25 AM
ahmed saPosted Jan 31, 2014, 8:18 AM
SUNIL GUTTAPosted Jan 30, 2014, 4:48 PM
done some small modifications better you to keep working on it .. still i havent gone though entire code .. ..
Added this SP :
Well as you requested to update on textchanged events of text_boxes i given a minor try but issue will be even a character modification in textbox also the textvalue goes to DB and updated . It will be burden on server .. Better plan like complete column check after next button click ... ..
KEEP BREAK POINTS FRIEND AND IMPLEMENT .. YOU WILL UNDERSTAND THE FLOW ..
SUNIL GUTTAPosted Jan 30, 2014, 3:27 PM
Well dude there is lot of work to be done like you written stored procedures looks quite annoying improper naming conventions i.e code in c# looks mystery for others to understand at one look ..
I am analyzing your code will update u by tomorrow .
Regards
ahmed saPosted Jan 30, 2014, 3:02 PM
you can create new database in sql server
then press in new query button then past in
database then parse and execute after that you will found table driver and his stored procedures
procedure found in stored procedure file
when you open the program in open database form
write in server name ip of database found if local also write ip of computer
and write name of database
then user id write sa or any user found in these database
password write password of user
ahmed saPosted Jan 30, 2014, 2:47 PM
SUNIL GUTTAPosted Jan 30, 2014, 1:37 PM
Nice but its .bak file .. any idea where to place in sqlserver 2008 in local system ? if so tell me .
The file is in unreadable format
ahmed saPosted Jan 30, 2014, 9:28 AM
SUNIL GUTTAPosted Jan 30, 2014, 8:07 AM
Note in fleet.cs the method public string UpdateDriver(.........) alwAYS RETURN integer i.e executenonquery returns integer output i.e how many records updated ..
public int UpdateDriver(string ConnectionString, int DriverNo, string DriverName,string Nationality,string Address)
{
{
}
later the updated result stored under variable a in ur code must be used in if condition like
private void textBox2_TextChanged(object sender, EventArgs e)
{
FleetManagment.Fleet fleet1 = new FleetManagment.Fleet();
int a = fleet1.UpdateDriver("Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "", Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text);
if(a > 0)
{
MessageBox.Show("Record changed successfully");
}
}
I cant check the code properly because i cant match my DB with ur app as i dont know ur excat db table schema etc ..
Try above modifications and revert back
ahmed saPosted Jan 30, 2014, 7:32 AM
ahmed saPosted Jan 30, 2014, 7:15 AM
Next button for navigate records exist(meaning that found) and make also incremental by 1 when i need to add records by same serial(you will see code in this time as you tell me before and already success in this)
the problem found now in form driver
I need when i press next button in form driver message box that found in text2_text changed event not show when
1- i load data in form load
2-or click next button
but only show message update when i update or change text in text box2
thank you very much for interest
SUNIL GUTTAPosted Jan 30, 2014, 4:45 AM
in which file i need to do modifications say i will do it . mention in detail possible ..
ahmed saPosted Jan 30, 2014, 2:00 AM
thanks
SUNIL GUTTAPosted Jan 29, 2014, 3:02 PM
Hi there
Provided you some example try like this :
next_update();
else
{
//write next row Retrieval statements
}
regards
Sunil G
--------------------------------Rate if you feel Helpful----------------------------------