|
i assumed that,that it should be the name of the table in the dataset.....But we are again creating a datatable dt1..are we assigning the value of the datatable,group,to dt1?And if i want to create one more table,patient,in teh same dataset will
da1.Fill(ds1,"patients");
DataTable dt2 = ds1.Tables["patients"];work?????????
|
|
|
|
|
|
Hi,
first of all: Don't cross post.
As already mentioned in the ASP.NET forum you have to use brackets in the correct way:
INSERT INTO Registration [DATE OF BIRTH], [CONTACT NUMBER] VALUES (...
Did you really use coulmn names with whitespace within your db? You should either use camelcase or underscore to seperate the words. And pay attention to sql injection (within your values). Search google for prepared statements.
Regards
Sebastian
|
|
|
|
|
INSERT INTO Registration ([DATE OF BIRTH], [CONTACT NUMBER]) VALUES ('" + DateT.Text + "','" + ContactT.Text + "')
Now look at parameters[^] to make your code more secure!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Why are you posting same thing on different forums....
Be an Eagle, Sky is Yours.
|
|
|
|
|
In addition to all the advice you've been given, please pick a relevant subject. This is the C# forum after all, can you imagine what it would look like if every thread were to have the subject "C#" ?
Cheers,
Vikram. (Proud to have finally cracked a CCC!)
|
|
|
|
|
Hi All,
I'm working on a project where on the left hand side of the form i have a treeview control and bottom to that i have some buttons. When user clicks on the node then i'm loading respective user control on to the right hand side of the form.
The issue here is i have two save buttons one on user control and other on the main form just below the treeview control. I have the code to capture the key press :
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.S))
{
MessageBox.Show("Do Something");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
Here this code works only for the main form but not for the user control.
Please let me know how can i capture the key press event for usercontrol so that i can call save event of usercontrol.
Thanks in Advance
Regards,
Prakash N
|
|
|
|
|
Set the property KeyPreview in main form to true, then you can get always the event "KeyDown".
|
|
|
|
|
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
string connection1 = ConfigurationManager.AppSettings["conn"];
OleDbConnection con1 = new OleDbConnection(connection1);
con1.Open();
OleDbDataReader dr;
string query = "select DISTINCT DEPARTMENT from TIME_DETAILS ";
//OleDbDataAdapter da1 = new OleDbDataAdapter(query,con1);
//DataSet ds1 = new DataSet();
//da1.Fill(ds1);
OleDbCommand cmd = new OleDbCommand(query,con1);
dr = cmd.ExecuteReader();
while (dr.Read())
{
DropDownList2.Items.Add(dr[0].ToString());
DropDownList2.DataValueField.Insert(dr[0]);
}
}
|
|
|
|
|
what is the error you are getting... please specify in which line of code the error occurs... this will help our experts to help you better....
|
|
|
|
|
there is no error but the values r not shown in the drop down list
|
|
|
|
|
Have you tried below posted code...
Be an Eagle, Sky is Yours.
|
|
|
|
|
thnx sir i got it now....
|
|
|
|
|
Instead of
ankitjain1110 wrote: while (dr.Read())
{
DropDownList2.Items.Add(dr[0].ToString());
DropDownList2.DataValueField.Insert(dr[0]);
}
Use this
DropDownList2.Items.Add(New ListItem(dr[0].ToString(),dr[0].ToString());
Be an Eagle, Sky is Yours.
|
|
|
|
|
this thing is showing an error like ")expected"
|
|
|
|
|
Oops, that's my mistake
Just place ) at the end of the statement befre ;
Be an Eagle, Sky is Yours.
|
|
|
|
|
thnx but its still not working
|
|
|
|
|
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
string connection1 = ConfigurationManager.AppSettings["conn"];
OleDbConnection con1 = new OleDbConnection(connection1);
con1.Open();
OleDbDataReader dr;
string query = "select DISTINCT DEPARTMENT from TIME_DETAILS ";
OleDbDataAdapter da1 = new OleDbDataAdapter(query,con1);
DataSet ds1 = new DataSet();
//da1.Fill(ds1);
OleDbCommand cmd = new OleDbCommand(query,con1);
da1.SelectCommand=cmd;
da1.Fill(ds1,"dept");
DataTable dep=ds1.Tables["dept"];
dr = cmd.ExecuteReader();
DropDownList2.DataSource=dep;
if(dep.Rows.Count>0)
{
foreach (DataRow row in dep.Rows )
{DropDownList2.Items.Add(row[0].ToString());}
}
//while (dr.Read())
//{
//DropDownList2.Items.Add(dr[0].ToString());
//DropDownList2.DataValueField.Insert(dr[0]);
// DropDownList2.Items.Add(New ListItem(dr[0].ToString())));
// }
}
i tried dis too...but its also not helping....no values r shown in the drop down list.plz help me
|
|
|
|
|
Why you are writing code in SelectedIndexChanged event of the same control.
ankitjain1110 wrote: DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
Write this code on form's or another control's event.
Like on Form's Load event....
Be an Eagle, Sky is Yours.
|
|
|
|
|
I've plenty of Rectangles in an image and I want to grab events on each MouseEnter and MouseLeave. I tried with a bool for each rectangle and set it true when Cursor gets in and set false when gets out but that things buggy when Rectangles are overlapping...thats why I'm looking for another way. Any idea ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
probably you must use event mouseMove and check if mouse pointer is inside rectangles. overlapping should be no problem anymore.
|
|
|
|
|
how can you say overlapping wont be problem ? BTW I'm using WndProc and WM_MOUSEMOVE
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
.NET has a method/event for it. Put your image in a pictureBox and use event Paint and MouseMove.
I would avoid WndProc and Windows Messaging if .NET provide some method for it.
|
|
|
|
|
How can I access a reporting service from C#? I want to generate a PDF file that I can attach to an e-mail message.
_____________________________
...and justice for all
|
|
|
|
|
You can use web services provided by sql server reporting services.
|
|
|
|