Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

Vote on your favorite hash algorithm here!

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-03-2008, 01:15 PM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Question C# database pull problem

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)
{

}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-03-2008, 03:03 PM
Pancrazio Pancrazio is offline
Newbie
 
Join Date: Jun 2008
Posts: 17
Credits: 0
Rep Power: 2
Pancrazio is on a distinguished road
Default Re: C# database pull problem

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'?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-06-2008, 11:53 AM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Question Re: C# database pull problem

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-06-2008, 08:55 PM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Talking Re: C# database pull problem

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-07-2008, 12:48 PM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Default Re: C# database pull problem

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 07-08-2008, 10:29 AM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Question Re: C# database pull problem

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??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -5. The time now is 08:46 PM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads