|
hai all ,
in database i used only one database for empid (int),username(varchar),password(varchar),status(int),usertype(varchar)
what ever i will assign that values are not inserted into database
iam getting value in text but iam not getting in query.
please see my code
<pre>
Label1 .Text =""; //for displaying in design phase
Label2 .Text ="String.Empty;";
Label3 .Text ="String.Empty";
Label4 .Text ="";
Label5 .Text ="String.Empty";
TextBox1 .Text ="empid"; //for entering
TextBox2 .Text ="username";
TextBox3 .Text ="password";
DropDownList1.DataValueField =""; //status 1 and 2
DropDownList2 .DataValueField ="usertype"; //for normal user and admin
SqlConnection con=new SqlConnection ("uid=sa;password=sa123;database=usermanagement;server=c113");
SqlCommand cmd=new SqlCommand ("insert into tbl_user_management (empid,username,password,status,usertype) values('"+ TextBox1.Text +"','"+ TextBox2.Text +"','"+ TextBox3.Text +"','"+ DropDownList1 .DataValueField +"','"+ DropDownList2 .DataValueField +"')",con);
//SqlDataReader dr;
con.Open ();
//status = Convert.ToInt32(dr["status"]);
cmd.ExecuteNonQuery();
con.Close ();
srinivas
|
|
|
|
|
srinivassam wrote: "insert into tbl_user_management (empid,username,password,status,usertype) values('"+ TextBox1.Text +"','"+ TextBox2.Text +"','"+ TextBox3.Text +"','"+ DropDownList1 .DataValueField +"','"+ DropDownList2 .DataValueField +"')"
Assign this to a string variable and print that string variable before you execute. Paste the query in query analyzer and you will get the problem. Warning, Using this method you are too close to SQL Injection Attacks. Better read Colin Angus Mckay's SQL Injection Attacks[^] article and change your method.
|
|
|
|
|
<code>("insert into tbl_user_management (empid,username,password,status,usertype) values('"+ TextBox1.Text +"','"+ TextBox2.Text +"','"+ TextBox3.Text +"','"+ DropDownList1 .DataValueField +"','"+ DropDownList2 .DataValueField +"')</code>
Try not to do any hardcode..use stored procedure using parameter to avoid SQLInjection..i think u got an error in that code because the empid type is in integer but u inserted a string value to it ( TextBox1 .Text ="empid"; )..try to convert TextBox1.Text to integer format and make sure TextBoxt1.text is a numeric and do this on your SQLcommand(...values('"+Convert.ToInt32(TextBox1.Text) +"',etc...)
regard,
TCim
|
|
|
|
|
hi
How cani access to another computer over interner network?
i want to use it to made a chatroom like yahoomessenger!
Thanks for your help.
|
|
|
|
|
ali_reza64 wrote: How cani access to another computer over interner network?
Using IP you can send data over network
ali_reza64 wrote: i want to use it to made a chatroom like yahoomessenger!
First you need to write a server application that can connect clients. Server should be multithreaded to accept multiple clients. You can use TCP connection. When one client is sending request to chat with another client, you need to establish a dedicated connection between those two machines and communicate each other.
|
|
|
|
|
Hi all,
I m try to connect crystal report with database(Access) but i have no idea about it plz help if you can proide code. or any logic.
thanks in advance,
Nikesh Yadav
CSS Infotech
Gurgaon,
Haryana(India).
|
|
|
|
|
Hi Nikesh,
To do that you have to specify the logon details. Plase refer the following link, that's for connecting to SQL Server.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1826353&SiteID=1
|
|
|
|
|
Good afternoon,
I have a question that need your help
When I summarized the monthly purchase orders(PO), I got my result effectively. But, when I show the names of selected POs in Page header, first I use Crosstab, it works well. Then, I realize that the crosstab will be limited when I provide more than 20 POs. I image about a string instead of Crosstab
My problem is that if I combine the names of POs into a string and assign the string to X2 field. How should I do ?
EX: The list PO can be shown PO1,PO2,PO3,PO4,..
I use Crystal Report in VS C# 2005
Sorry about my English.
I will appreciate your help ! If I misunderstand problem, please kindly explain me well.
It seem to be a solution or an answer.
|
|
|
|
|
Hi,
I m try to connect crystal report with database(Access) but i have no idea about it plz help if you can provide code. or any logic.If You can help me.
Plz do so
thanks in advance,
Nikesh Yadav
CSS Infotech
Gurgaon,
Haryana(India).
|
|
|
|
|
I have written code to write data in file with Filestream class,but the problem is, When i open the file i see data in some other format.Pls give me some help or some link, which can help me to do my task.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
|
Thank u for reply,I wanna to write in ascii format.What i wanna is that if i write text as:
abcd
ef
gh
i want to add 123 after e, so it should look like
abcd
e123f
gh
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Use the StreamReader and StreamWriter classes. You can use then statemens like MyStream.WriteLine("Mytext"); Please check the documentation of these classes for examples.
Rudolf Heijink
|
|
|
|
|
Hello Every body,
I had used an array to populate the combo box ,(working on windows application with c# )
I am able to populate the displayMember but I am not able to populate its value member.
I am getting folowing error:
Cannot bind to the new display member.
Parameter name: newDisplayMember
Regards,
rahul saini
|
|
|
|
|
monuSaini wrote: Cannot bind to the new display member.
Parameter name: newDisplayMember
Can you show us your code?
I guess, it's not like that. isn't it?
string[] str = new string[] { "One", "Two", "Three" };<br />
comboBox1.DataSource = str;<br />
comboBox1.Refresh();
|
|
|
|
|
Hi Michael,
Thanks for rplying.
I am using following code:
string[] Level = new string[] {"Level A","Level B","Level C" };
int[] LevelValue = new int[] { 0,1, 2 };
for (int i = 0; i < Level.Length ; i++)
{
comboBox.DisplayMember = userLevel[i].ToString();
comboBox.ValueMember = i.ToString();
comboBox.DataSource = Level;
}
Regards,
rahul saini
|
|
|
|
|
Below are parts of the code that i've done, However, it does not detect the mousedown over the area or the rectangle or ellipse. Where did i do the mistake? Can anybody help?
Thanks
public class Form1 : System.Windows.Forms.Form
{
private System.Drawing.Bitmap m_objDrawingSurface;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
Graphics objGraphics;
Rectangle rectBounds;
Rectangle rectangle=new Rectangle(0,10,50,50);
Rectangle ellipse=new Rectangle(100,10,50,50);
private Point mouse_pos;
.................................................................
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
Point current_pos = Control.MousePosition;
mouse_pos.X = e.X;
mouse_pos.Y = e.Y;
if (rectangle.Contains(current_pos.X,current_pos.Y ))
{ MessageBox.Show("Detect rectangle", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);}
else if (ellipse.Contains(current_pos.X,current_pos.Y ))
{MessageBox.Show("Detect ellipse", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);}
else
return;
}
Edit/Delete Message
|
|
|
|
|
cyn8 wrote: Graphics objGraphics;
Why do you have a member graphics object ? I don't see how that's ever a good idea.
cyn8 wrote: Control.MousePosition;
What is this ? Have you tried to trace it's value to see if it's what you expect ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm sorry, i'm just a begineer. therefore, there mayb alot of mistakes that i might have done. However, what do you suggest i can do in order to achieve the result. Assume that i need to display 3 shape(circle, rectangle and a triangle). I should be able to select any of them at one time to be drag and drop.
thanks
|
|
|
|
|
Hello Christian,
Christian Graus wrote: Why do you have a member graphics object ? I don't see how that's ever a good idea.
I normaly never need to draw on Images, but I was interested by a question here on the forum.
The task is to Draw on the BackgroundImage of a panel.
I did a little test project and thought this is a good idea:
private Graphics panelGraphics = null;
private Pen leftPen = new Pen(Color.Red,2);
private Pen rightPen = new Pen(Color.White,2);
private Point oldPosition;
private bool init=false;
private void panel2_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if((e.Button == MouseButtons.Left) || (e.Button == MouseButtons.Right))
{
Pen actPen;
if(e.Button == MouseButtons.Left)
{
actPen = leftPen;
}
else
{
actPen = rightPen;
}
if(panel2.BackgroundImage==null)
panel2.BackgroundImage= new Bitmap(panel2.Width, panel2.Height);
if(panelGraphics==null)
panelGraphics = Graphics.FromImage(panel2.BackgroundImage);
if(init)
{
Point newPostion = new Point(e.X,e.Y);
panelGraphics.DrawLine(actPen, oldPosition, newPostion);
Refresh();
}
init=true;
oldPosition = new Point(e.X,e.Y);
}
}
private void panel2_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
init=false;
}
private void panel2_MouseLeave(object sender, System.EventArgs e)
{
init=false;
}
As you can see I also used a member graphics object, and now I'm curious what you think of it.
Thanks for your time!
P.S.: I would Dispose all the IDisposable members in the Dispose method of the form, off course!
All the best,
Martin
|
|
|
|
|
Hello,
It seems that your MouseDown is not even fired, because your Mouse is over an Control.
Therefore you have to Handle the MouseDown on the Control itselfe.
All the best,
Martin
|
|
|
|
|
i quite sure that my mousedown is fired on the form itself. If it doesn't, like what u said, what should i do to fix it?
thanks
|
|
|
|
|
as I know to install SQL server 2005 there should be a server installed .is there any other way to install sql server 2005 in window xp.
in SQLexpress server 2005.
problem is it allows to log on to the server in windows authentication , can create new logins for SQL authentication mode but doesn't allow to logon in sql authentication mode.
|
|
|
|
|
|
Hi,
Can Anyone Give me an article or maybe a tutorial guide about "Custom Tab Control", "Binding Tab Control" or something related to that
Thank You,
Kind Regard,
TCim
|
|
|
|
|