Click here to Skip to main content
15,909,440 members
Home / Discussions / C#
   

C#

 
AnswerRe: Custom Editor for TabPages in PropertyGrid Pin
Bernhard Hiller27-Oct-11 21:34
Bernhard Hiller27-Oct-11 21:34 
QuestionRemove Enum prefix from tlb Pin
liqnit27-Oct-11 0:29
liqnit27-Oct-11 0:29 
AnswerRe: Remove Enum prefix from tlb Pin
Pete O'Hanlon27-Oct-11 1:25
mvePete O'Hanlon27-Oct-11 1:25 
GeneralRe: Remove Enum prefix from tlb Pin
liqnit27-Oct-11 2:40
liqnit27-Oct-11 2:40 
GeneralRe: Remove Enum prefix from tlb Pin
Pete O'Hanlon27-Oct-11 3:10
mvePete O'Hanlon27-Oct-11 3:10 
GeneralRe: Remove Enum prefix from tlb Pin
Dave Kreskowiak27-Oct-11 3:48
mveDave Kreskowiak27-Oct-11 3:48 
GeneralRe: Remove Enum prefix from tlb Pin
liqnit29-Oct-11 21:05
liqnit29-Oct-11 21:05 
QuestionUpdating an access database table using C# Pin
Theresho26-Oct-11 23:47
Theresho26-Oct-11 23:47 
Im a java developer, new in C#. Im developing a program using C# that saves records of consultations made at a cancer specialised clinic. The user selects a vaccine name, patient, etc. name from records retrived from database and has to get respective ids and use them to update the consultation table in the same database as foreign keys. This is the code that I have, please let me know what I am doing wrong

private void btnSubmit_Click(object sender, EventArgs e)
{

DataSet dataSet = new DataSet();
DataSet vdataSet = new DataSet();
DataSet udataSet = new DataSet();

OleDbCommand cmd = conn.CreateCommand();
OleDbCommand cmdd = conn.CreateCommand();
OleDbCommand com = conn.CreateCommand();
OleDbCommand dbc = conn.CreateCommand();

TextBox patID = new TextBox();
TextBox vacID = new TextBox();
TextBox useID = new TextBox();

patID.Visible = false;
vacID.Visible = false;
useID.Visible = false;

cmd.CommandText = "SELECT patientID FROM patient WHERE fName = '" + cbPatient.GetItemText(cbPatient.SelectedItem) + "'";
cmdd.CommandText = "SELECT vaccineID FROM vaccine WHERE vName = '" + listVaccine.GetItemText(listVaccine.SelectedItem) + "'";
com.CommandText = "SELECT userID FROM userDetails WHERE username = '" + cbUserName.GetItemText(cbUserName.SelectedItem) + "'";
dbc.CommandText = "INSERT INTO Consultation (date, patientID, vaccineID, userID, diagnosis) VALUES ('" + DateTime.Now.ToString() + "', " + patID.Text + ", " + vacID.Text + ", " + useID.Text + ", '" + cbDiagnosis.SelectedItem + "')";

conn.Open();

OleDbDataAdapter dataAdapter = new OleDbDataAdapter(cmd);
OleDbDataAdapter vdataAdapter = new OleDbDataAdapter(cmdd);
OleDbDataAdapter udataAdapter = new OleDbDataAdapter(com);
OleDbDataAdapter da = new OleDbDataAdapter(dbc);

dataAdapter.Fill(dataSet);
vdataAdapter.Fill(vdataSet);
udataAdapter.Fill(udataSet);

patID.Text = dataSet.Tables[0].Rows[0].ItemArray[0].ToString();
vacID.Text = vdataSet.Tables[0].Rows[0].ItemArray[0].ToString();
useID.Text = udataSet.Tables[0].Rows[0].ItemArray[0].ToString();

MessageBox.Show(patID.Text);
MessageBox.Show(vacID.Text);
MessageBox.Show(useID.Text);

dbc.ExecuteNonQuery();

conn.Close();

MessageBox.Show("Entry added!");

}
AnswerRe: Updating an access database table using C# Pin
Richard MacCutchan27-Oct-11 0:32
mveRichard MacCutchan27-Oct-11 0:32 
AnswerRe: Updating an access database table using C# Pin
BobJanova27-Oct-11 3:05
BobJanova27-Oct-11 3:05 
AnswerRe: Updating an access database table using C# Pin
jschell27-Oct-11 8:35
jschell27-Oct-11 8:35 
Question"Linked open data" in C# ASP.Net Pin
shanNSK26-Oct-11 20:49
shanNSK26-Oct-11 20:49 
AnswerRe: How to Convert URL to URI in rdf format? Pin
OriginalGriff26-Oct-11 22:00
mveOriginalGriff26-Oct-11 22:00 
QuestionC# access setting file Pin
sc steinhayse26-Oct-11 5:46
sc steinhayse26-Oct-11 5:46 
AnswerRe: C# access setting file Pin
Richard MacCutchan26-Oct-11 6:23
mveRichard MacCutchan26-Oct-11 6:23 
QuestionPreferred style Pin
Reiss26-Oct-11 5:24
professionalReiss26-Oct-11 5:24 
GeneralRe: Preferred style Pin
harold aptroot26-Oct-11 5:37
harold aptroot26-Oct-11 5:37 
AnswerRe: Preferred style Pin
Paul Conrad26-Oct-11 5:42
professionalPaul Conrad26-Oct-11 5:42 
AnswerRe: Preferred style Pin
PIEBALDconsult26-Oct-11 6:29
mvePIEBALDconsult26-Oct-11 6:29 
AnswerRe: Preferred style Pin
Luc Pattyn26-Oct-11 6:31
sitebuilderLuc Pattyn26-Oct-11 6:31 
AnswerRe: Preferred style Pin
SledgeHammer0126-Oct-11 8:42
SledgeHammer0126-Oct-11 8:42 
GeneralRe: Preferred style Pin
harold aptroot26-Oct-11 9:09
harold aptroot26-Oct-11 9:09 
GeneralRe: Preferred style Pin
SledgeHammer0126-Oct-11 9:24
SledgeHammer0126-Oct-11 9:24 
AnswerRe: Preferred style Pin
BobJanova26-Oct-11 22:39
BobJanova26-Oct-11 22:39 
AnswerCheers Pin
Reiss27-Oct-11 22:02
professionalReiss27-Oct-11 22:02 

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.