|
SqlConnection conn=new SqlConnection("server=(local);Initial Catalog=Northwind;user id=istore;pwd=istore");
conn.Open();
SqlCommand cmd=new SqlCommand("select employeeid from employees where employeeid=1",conn);
Label1.Text=Convert.ToString(cmd.ExecuteScalar());
-------------
this code surely works
try it!!;P
|
|
|
|
|
SqlCommand cmd=new SqlCommand("select employeeid from employees where employeeid=1",conn);
Label1.Text=Convert.ToString(cmd.ExecuteScalar());
employeeid is an int in db.
answer is coming in label, but if i put a variable like dis :
int s = Convert.ToString(cm.ExecuteScalar());it gives error : Cannot implicitly convert type 'string' to 'int'.
if i put variable like:
string s = Convert.ToString(cm.ExecuteScalar());
it gives error : Cannot convert from 'string' to 'int', in the below function.
as i have to display dis employeeid ie 's' in a function:
funEntrylogin(s, tb_id.Text, tb_pswd.Text, DateTime.Now, DateTime.Now);
|
|
|
|
|
Hi!
I have to implement CSS in my C# asp.net web application.
I made a Css class and used it in my aspx form. But formatting is applied only on backgroud of the form. formatting on the web controls like buttons and labels is not applied. Can anyone guide me to solve this problem.
Thanx
|
|
|
|
|
This is not a C# question, it belongs in the web development forum ( as it has nothing to do with ASP.NET, or C# ).
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
anyone have an idea how to concatenate SortedLists? and also get its half?
for example say i have SortedLists s1, s2, s3. I would like to add all the top/end halves of each SortedLists into a single one, say sTotal;
thanks!
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
Please, could anyone send me a C# source code to draw an ellipse by pressing a button?
Thank you very much.
Saludos, Giovanni
|
|
|
|
|
Why would you ask this again, when your original message is two posts down ? Why not read what I suggested ? If you can't follow my explanation, ask me. If you're incapable of writing this yourself, give up on working at this level of complexity and do some work to bring yourself up to this level by studying something more at your level.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If you believe you are a genius, why don't answer to the specific question?.
Else avoid answer me.
Saludos, Giovanni
|
|
|
|
|
I didn't say I was a genius. I *did* answer your question.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi!
i have to use media player control to play video clips. I have found no control for it. Actually i dont want to code in asp.So can anyone help me in using control and its coding in C#.
waiting for urgent reply.
Thanx
|
|
|
|
|
If you're using ASP.NET, then you need to embedd it using HTML. C# won't help you at all, as the C# code runs on the server, not the client.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Please, help me:
I need to draw an ellipse, which parameters must be stablished in textboxes, and when pressing on a button can draw an ellipse (or another geometric) with the parameters of the textboxes.
Also, if I change some parameter in some textbox, and then by pressing again on the button, the ellipse should change according to the new parameters.
Thank you very much.
Saludos, Giovanni
|
|
|
|
|
You need to add a paint handler, that shuold check your textboxes, using int.TryParse to see if they contain numbers. If they do, use them to draw your ellipse, using the Graphics object passed in on the event args.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
use C#+asp.net+Sql Server2000 all sourcecode opened
good learn tools
www.drpsky.com
your friend
|
|
|
|
|
If you want to advertise your site, contact the sys admin for pricing on advertising.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello, recently I have been toying around with the System.Drawing namespace. But it does not seem that it ever updates even if it is in an onPaint event handler.
This is all the code i put in the entire class. I changed nothing else.
public partial class Form1 : Form
{
int Cheese = 1;
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics MyGraphics = e.Graphics;
Brush MyBrush = Brushes.Aqua;
Font MyFont = new Font(FontFamily.GenericSansSerif, 12);
MyGraphics.DrawString(System.Convert.ToString(Cheese), MyFont, MyBrush, 10, 10);
Cheese = Cheese + 1;
}
}
What should i be doing?
(The output is constantly "1")
Thanks.
|
|
|
|
|
Call Invalidate() to force a paint event, in a button handler, and it will work.
Use Cheese.ToString() instead of Convert.ToString. Or " " + Cheese, will also work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
It's because the window only paints itself once unless there's reason to repaint it again. For example, the number should increase if you hide the window (maybe minimize it), then reshow the window. It will have repainted a number of times.
FYI, you can force a paint in code using the Invalidate() method of the Form class. Invalidate tells the operating system that a repaint is needed, and it will repaint at the next opportunity.
|
|
|
|
|
Hi,
I am developing windows mobile application using vs05 C#.NET..
How to install exe file with icon/logo to Windows Mobile programs collection or main menu?
I want to put my exe file icon in Start/ Programs/ ...Directly can i click the icon in programs? please help me...I am new in the field.
Thanks in advance..
Bye
|
|
|
|
|
Can I please help to know, how to pass a reference from your command class to a windows user ?
Can any body give me a code?
Thanks
Kedie
|
|
|
|
|
What do you mean ? Any reference type ( i.e. a class ) is passed by reference already. What is your 'command class' ? How do you want to 'pass a reference to a windows user' ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
This may not help but if you mean passing arguments by reference then I found I had to put the keyword "ref" in front of the argument - both in the definition and the use. i.e. MyFunc(ref int argument) & MyRef(ref argument).
I hope this is of some help.
Ted Edwards
|
|
|
|
|
Hi,
I am using visual studio team suite 2005 for developing a windows app in C#
I have 2 forms Form1 and Form2
I have a button control on Form1 called Bttn. In the click event of the button i am writing the following code so that i close the current Form i.e. Form1 and want to show Form2.
MY code::
Form1 f = new Form1();
f.Close();
Form2 r = new Form2();
r.Visible = true;
but with this i have 2 problems
1) Form1 is not closed and Form2 is open i.e. both forms are opened (f.close() is not working)
2) After running the app, when i close Form1 Strangely Form2 is also closed.
but however if i close Form2 only that form2 is closed as expected. I am not implementing any mdi forms concept.
Any help is appreciated
thanks red
yojimbo
|
|
|
|
|
red60mans wrote: Form1 f = new Form1();
f.Close();
You've never shown this form, Close will do nothing.
red60mans wrote: Form2 r = new Form2();
r.Visible = true;
This doesn't work, you need to call ShowDialog(), or Show() for a modeless form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Form1 is shown from from Main as follows
main()
{
Application.Run(new Form1());
}
buttonClick event on form1
{
Form1 f = new Form1();
f.Close();
Form2 r = new Form2();
r.Visible = true;
)
This ia modeless form and also am not using any mdi forms concept
I tried r.show() also
its not working
yojimbo
|
|
|
|