Home › Forums › C# Programming › C# and SQL problem
- This topic has 0 replies, 1 voice, and was last updated 16 years, 4 months ago by CRavi.
- AuthorPosts
- July 9, 2008 at 10:05 am #2113CRaviParticipant
Hello,
I am doing a big project for personal goal to get more familiar with C# Programming and SQL, ok the project is a help desk simple and small, i have 3 forms, the first asks you to either go into form 2 which is the profile to have the user enter customer profile information (first name, last name etc) and in form 2 there are 4 buttons, add (add new customer profile), Delete (delete customer profile that is selected), Update( select the customer from the listbox and in the text field change anything and have it take changes fast in SQL database), and of course close,
MY problem i have the code below, for the add button, when i click on it, it will add a new blank field in the list box which after i click add, i have to click on the list box for a drop down of a blank line and select it to add, is there a way to just click add and it clears all fields for the add new customer profile?
The Delete button is also a problem, when i select a profile to delete, it delete the entire thing!! not good, and what is weird is it has the same problem as the update, any changes made using the C# to interact with SQL DB, once i close out the program and re-open it, the changes made are gone, it goes back to older.
Update problem is when i make a change click update, it looks like it works because i go out of form 2 back to form 1, click on form2 again and it took the change, but closing out the program entering it back it will go back to old settings, whats the deal? i know the buttons are hard to get but button 2 is update, button 3 is add, button 4 is delete. i have ALL the code listed below PLEASE HELP!! MSDN or other forums no help….
This is form 2 customer profile:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175Code:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication1{public partial class Form2 : Form{public Form2(){InitializeComponent();}private void textBox2_TextChanged(object sender, EventArgs e){}private void textBox6_TextChanged(object sender, EventArgs e){}private void button2_Click(object sender, EventArgs e){this.Close();}private void Form2_Load(object sender, EventArgs e){// TODO: This line of code loads data into the 'insighthdDataSet.enterinfo' table. You can move, or remove it, as needed.this.enterinfoTableAdapter.Fill(this.insighthdDataSet.enterinfo);enterinfoTableAdapter.Fill(insighthdDataSet.enterinfo);}private void button3_Click(object sender, EventArgs e){}private void button1_Click(object sender, EventArgs e){insighthdDataSetBindingSource.EndEdit();enterinfoTableAdapter.Update(insighthdDataSet.enterinfo);MessageBox.Show("Update Complete");}private void bindingSource1_CurrentChanged(object sender, EventArgs e){}private void label24_Click(object sender, EventArgs e){}private void primarycontactLabel_Click(object sender, EventArgs e){}private void enterinfoBindingNavigatorSaveItem_Click(object sender, EventArgs e){}private void enterinfoBindingNavigator_Refre........ems(object sender, EventArgs e){}private void fillByToolStripButton_Click(object sender, EventArgs e){}private void customerticketTextBox_TextChanged(object sender, EventArgs e){}private void listBox1_SelectedIndexChanged(object sender, EventArgs e){}private void enterinfoBindingNavigatorSaveItem_Click_1(object sender, EventArgs e){}private void integratorcompanyTextBox_TextChanged(object sender, EventArgs e){}private void enterinfoBindingNavigatorSaveItem_Click_2(object sender, EventArgs e){this.Validate();this.enterinfoBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.insighthdDataSet);}private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e){}private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e){}private void toolStripButton1_Click(object sender, EventArgs e){}private void fillByToolStripButton_Click_1(object sender, EventArgs e){try{this.enterinfoTableAdapter.FillBy(this.insighthdDataSet.enterinfo);}catch (System.Exception ex){System.Windows.Forms.MessageBox.Show(ex.Message);}}private void bindingNavigatorMoveNextItem_Click(object sender, EventArgs e){}private void customerlocationTextBox_TextChanged(object sender, EventArgs e){}private void enterinfoBindingSource_CurrentChanged(object sender, EventArgs e){}private void button3_Click_1(object sender, EventArgs e){}private void button3_Click_2(object sender, EventArgs e){insighthdDataSet.enterinfoRow row =insighthdDataSet.enterinfo.NewenterinfoRow();insighthdDataSet.enterinfo.Rows.Add(row);}private void button4_Click(object sender, EventArgs e){insighthdDataSet.enterinfo.Clear();}}}- This topic was modified 2 years, 9 months ago by M. Saqib.
- AuthorPosts
- The forum ‘C# Programming’ is closed to new topics and replies.