Click here to Skip to main content
15,886,026 members
Home / Discussions / C#
   

C#

 
GeneralType.GetType Pin
Silly Boy27-May-04 18:53
Silly Boy27-May-04 18:53 
GeneralRe: Type.GetType Pin
ian mariano27-May-04 20:24
ian mariano27-May-04 20:24 
GeneralC# and SQL Autonumber Pin
Antonius_r327-May-04 18:06
Antonius_r327-May-04 18:06 
GeneralRe: C# and SQL Autonumber Pin
Grimolfr28-May-04 3:20
Grimolfr28-May-04 3:20 
GeneralRe: C# and SQL Autonumber Pin
Dave Kreskowiak28-May-04 3:26
mveDave Kreskowiak28-May-04 3:26 
GeneralRe: C# and SQL Autonumber Pin
Antonius_r328-May-04 7:26
Antonius_r328-May-04 7:26 
GeneralRe: C# and SQL Autonumber Pin
Dave Kreskowiak28-May-04 7:54
mveDave Kreskowiak28-May-04 7:54 
GeneralRe: C# and SQL Autonumber Pin
Antonius_r329-May-04 3:48
Antonius_r329-May-04 3:48 
The complete code will be very long, but let me explain and send you more detail code.

What I am trying to do is make a form for data input, so the user will select customer from the combo box, and fill the textbox for description of the job. For the date, it will automatically entered.
When the user hit save button, it will create new JobID, and I was hoping to get it print out, but not yet there.

This is the more complete or detail code:

<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
<br />
namespace Program_Service<br />
{<br />
<br />
public class frm_tandaterima_baru : System.Windows.Forms.Form<br />
{<br />
	/// <summary><br />
	/// Required designer variable.<br />
	/// </summary><br />
	private System.ComponentModel.Container components = null;<br />
	private System.Windows.Forms.Label lbl_customerID;<br />
	private System.Windows.Forms.Label lbl_description;<br />
	private System.Windows.Forms.TextBox txt_description;<br />
	private System.Windows.Forms.ComboBox cmb_cust;<br />
	private System.Windows.Forms.Button btn_save;<br />
	private System.Windows.Forms.Button btn_newjob;<br />
	private System.Windows.Forms.Button btn_exit;<br />
	private System.Data.SqlClient.SqlDataAdapter jobDA;<br />
	private System.Data.SqlClient.SqlCommand select_job;<br />
	private System.Data.SqlClient.SqlCommand update_job;<br />
	private System.Data.SqlClient.SqlCommand insert_job;<br />
	private System.Data.SqlClient.SqlCommand delete_job;<br />
	private Program_Service.ds_parent jobDS;<br />
	private System.Data.SqlClient.SqlDataAdapter custDA;<br />
	private System.Data.SqlClient.SqlCommand sqlSelectCommand1;<br />
	private System.Data.SqlClient.SqlCommand sqlInsertCommand1;<br />
	private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;<br />
	private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;<br />
<br />
public frm_newjob()<br />
{<br />
	//<br />
	// Required for Windows Form Designer support<br />
	//<br />
	InitializeComponent();<br />
	//<br />
	// TODO: Add any constructor code after InitializeComponent call<br />
	//<br />
}<br />
protected override void Dispose( bool disposing )<br />
{<br />
	if( disposing )<br />
	{<br />
		if(components != null)<br />
		{<br />
			components.Dispose();<br />
		}<br />
	}<br />
	base.Dispose( disposing );<br />
}<br />
<br />
private void frm_newjob_Activated(object sender, System.EventArgs e)<br />
{<br />
	// Fill DataSet with all data needed<br />
	custDA.Fill(jobDS, "table_cust");<br />
	// Set the focus on activated<br />
	this.cmb_cust.Focus();<br />
}<br />
private void btn_save_Click(object sender, System.EventArgs e)<br />
{<br />
        jobDA.Fill(jobDS, "table_job");<br />
<br />
        DataRow job = jobDS.Tables["table_job"].NewRow();<br />
        job["CustomerID"] = cmb_cust.ValueMember;<br />
        job["Date"] = date.Value;<br />
        job["Description"] = txt_description.Text;<br />
        jobDS.Tables["table_job"].Rows.Add(job);<br />
        jobDA.Update(jobDS, "table_job");<br />
}<br />
<br />
private void btn_newjob_Click(object sender, System.EventArgs e)<br />
{<br />
	// Clear all text box for new data<br />
	this.txt_description.Clear();<br />
}<br />
<br />
private void btn_exit_Click(object sender, System.EventArgs e)<br />
{<br />
	this.Close();<br />
}<br />
}<br />
}<br />


All of the component I had in the form are being put by using designer mode.

One change that I've made on the jobDS.xsd is that the column jobID: nillable = true, NullValue = (Null), ReadOnly = True.

Please advice what should I do, and thank you very much for your attention and help.
GeneralRe: C# and SQL Autonumber Pin
Dave Kreskowiak29-May-04 14:25
mveDave Kreskowiak29-May-04 14:25 
GeneralRe: C# and SQL Autonumber Pin
Antonius_r329-May-04 18:56
Antonius_r329-May-04 18:56 
GeneralRe: C# and SQL Autonumber Pin
Dave Kreskowiak30-May-04 3:22
mveDave Kreskowiak30-May-04 3:22 
GeneralRe: C# and SQL Autonumber Pin
Antonius_r331-May-04 13:02
Antonius_r331-May-04 13:02 
QuestionHow to make points well -distributed ? Pin
fu027-May-04 18:04
fu027-May-04 18:04 
AnswerRe: How to make points well -distributed ? Pin
Broken God28-May-04 20:17
Broken God28-May-04 20:17 
GeneralSNMP MIB : How to use it with C# Pin
youssef27-May-04 12:28
youssef27-May-04 12:28 
GeneralRe: SNMP MIB : How to use it with C# Pin
Dave Kreskowiak28-May-04 3:18
mveDave Kreskowiak28-May-04 3:18 
GeneralRe: SNMP MIB : How to use it with C# Pin
youssef28-May-04 3:42
youssef28-May-04 3:42 
GeneralRe: SNMP MIB : How to use it with C# Pin
Dave Kreskowiak28-May-04 3:48
mveDave Kreskowiak28-May-04 3:48 
GeneralRe: SNMP MIB : How to use it with C# Pin
youssef28-May-04 3:58
youssef28-May-04 3:58 
GeneralDock two forms Pin
Guinness4Strength27-May-04 11:41
Guinness4Strength27-May-04 11:41 
GeneralRe: Dock two forms Pin
Heath Stewart27-May-04 12:27
protectorHeath Stewart27-May-04 12:27 
GeneralRe: Dock two forms Pin
Guinness4Strength27-May-04 19:19
Guinness4Strength27-May-04 19:19 
GeneralRe: Dock two forms Pin
Dave Kreskowiak28-May-04 1:21
mveDave Kreskowiak28-May-04 1:21 
GeneralRe: Dock two forms Pin
Guinness4Strength28-May-04 3:16
Guinness4Strength28-May-04 3:16 
GeneralRe: Dock two forms Pin
Heath Stewart30-May-04 6:06
protectorHeath Stewart30-May-04 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.