|
||||||
| C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hello everyone, miss me, jk moving on to two questions/problems, the great news is i am almost finished with my simple help desk ticket system, maybe when i finish it and work out the bugs i will share for an example. ON WITH THE QUESTIONS/PROBLEMS
1. I have a drop down box that has customer locations, when i drop down the box, click on the location, what it should do is fill in all the text boxes below from customer location such as there name, telephone number, address etc, what it does instead when you click on the drop down box and select from a list of customers, select a customer and it does not update the text box for that new customer selected instead it stays with the last customer you selected, I have the C# program code below if you want to further take a look. 2. I have a total of 3 forms, first form gives you two choices which is form 2 and 3, 2nd form is described above where you make the customer profile, which has all information you entered about the customer, now the problem is getting it to form 3, well just 1 information in a drop box to make it a selection, what the user is going to do is select or choose a customer from customer location like on form 2 however what happens is it is blank, how do i pull information from the Database called insighthd which i know form 2 has access can update/delete and add from the database in the GUI interface, the problem is pulling some information from form 2 to form 3, how can this be done? Thank you for your patience and reading, the code is below for form 2, let me know if you need form 3 C# code as well. 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.insighthdData Set.enterinfo); } private void button3_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { insighthdDataSetBindingSource.EndEdit(); enterinfoTableAdapter.Update(insighthdDataSet.ente rinfo); 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.insighthdD ataSet); } private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { } private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { } private void toolStripButton1_Click(object sender, EventArgs e) { } } } |
| Sponsored Links |
|
|
|
|||
|
I never used datasets and table adapters but readers instead, so don't blame me for getting it wrong.
But I think you mean a listbox and not a dropdown list. If I'm getting it right you're trying to achieve a change in your textboxes on a change of the selected value in the listbox? So I think this shouldn't be empty: private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } Maybe you would like to put something in there instead of in 'private void button1_Click'? |
|
|||
|
bulls eye thanks, ya duh that would make a difference huh lol, but hate to ask you think since i am new what would i put in there then in the button? and yes your right it is a listbox and not a dropdown box. thanks for any input
|
|
|||
|
corrections, sorry again it is listbox instead of drop down box, and if it is a listbox after selecting the certain name from the list, i would like it to populate the information of the database of the columns entered in the SQL database linked, Crazio, you did say you usually use a reader to read the database? how about writing into/edit? and if so, can you tell me more or give an example that can help me out with my small project? or if anyone can help me out with the above info would be great as well so the text boxes can populate the rest of the info from the customer database SQL when selected from the list box, is it like getline?
Thanks again all |
|
|||
|
Hello Everyone, I have some good news, found the website that can help me alot with what pancrazio was talking about using the code to link the database in C# which is on this website http://www.codeproject.com/KB/databa...in_csharp.aspx
However the problem is, when it says to start making a Then we create a SqlConnection and specifying the connection string. SqlConnection myConnection = new SqlConnection("user id=username;" + "password=password;server=serverurl;" + "Trusted_Connection=yes;" + "database=database; " + "connection timeout=30"); My question is... where do you put that? on the form itself by double clicking on the form itself and inserting into it? on the button etc it does not say where? |
| Sponsored Links |
|
|
|
|||
|
Hello Everyone,
Great news, got the data to finally come up together when i select a particular name of the customer location, once selected all the text boxes are filled in, now the only problem is making a button that can do an update when changes are made, a delete button to delete the row, or add a new row, any help please?? |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: Java Database Connectivity | Jordan | Java Tutorials | 1 | 10-08-2008 04:26 AM |
| Tutorial: Storing Images in MySQL with PHP | Jordan | PHP Tutorials | 13 | 09-23-2008 06:11 PM |
| linking SQL database with C# problem | Siten0308 | C# Programming | 14 | 07-02-2008 05:50 PM |
| Problem read pwd protected Access2K dbase - CR9 & VB6 | mrbar | Visual Basic Programming | 2 | 03-10-2008 04:50 AM |
| Best program for SQL database manipulation | Rhadamanthys | Database & Database Programming | 3 | 07-02-2007 02:32 PM |
| Xav | ........ | 1357.94 |
| MeTh0Dz|Reb0rn | ........ | 1075.89 |
| WingedPanther | ........ | 919.18 |
| marwex89 | ........ | 906.86 |
| morefood2001 | ........ | 900.18 |
| John | ........ | 890.77 |
| Brandon W | ........ | 770.65 |
| chili5 | ........ | 312.39 |
| Steve.L | ........ | 264.99 |
| dcs | ........ | 232.34 |
Goal: 100,000 Posts
Complete: 83%