|
insert into dashboarddealerlogin (logoutdatetime) values (GETDATE())
It is giving error : Cannot insert value null in logoutdatetime.
Anywaz, let it b.
Just c this :
private void logout_Click(object sender, EventArgs e)
{
conn.Open();
string strQury = "";
strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")'";
SqlCommand cm = new SqlCommand(strQury, conn);
int n = Convert.ToInt32(cm.ExecuteScalar());
}
I have written this code in form1.cs n i have to write it here only.
Now i want to use this 'int n' in a function in form2.cs
funEntrylogin(m, i, tb_id.Text, tb_pswd.Text, DateTime.Now,n);
but here it is giving error on 'n'.
how can i do this?
thanx.
nekshan.
|
|
|
|
|
'private void logout_Click(object sender, EventArgs e)
'{
'conn.Open();
'string strQury = "";
'strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")'";
'SqlCommand cm = new SqlCommand(strQury, conn);
'int n = Convert.ToInt32(cm.ExecuteScalar());
'}
'above query is correct.return value for n is (0 or 1) if n=0 then not row update and n=1 then row updated. error is on something else.
|
|
|
|
|
u test query in sql query bilder but system.datatime.now() is a function of vb.net so its not run in builder but code i sent u is correct '(" + DateTime.Now + ")'
|
|
|
|
|
Nekshan wrote: strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "';
what is wrong?
You have forgotten the parenthesis around the values, and you have forgotten to convert the DateTime value into a string:
strQury = "insert into dashboarddealerlogin (logoutdatetime) values ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');
You should make sure that the date format that you use is understood correctly by the database. I prefer the ISO 8601 date format as it's unambigous.
---
single minded; short sighted; long gone;
|
|
|
|
|
Nekshan wrote: ...barobar implement nai thayu haji,i'll try it 2mrw now.
|
|
|
|
|
I tried Windows Vista on my laptop, and one of the great features I found was the ability to customize power options in great detail, particularly, the ability to set a maximum limit for cpu activity. Is it possible to do that on Windows XP? If not directly, is there a way to write application that does this? Does the .NET framework expose such functionality?
|
|
|
|
|
|
I checked the webpage you referenced. Well, it showed the signatures and declarations but I couldn't figure out what it actually does.
|
|
|
|
|
Hi, I'm a Java programmer and I know a bit of C# (let's say all the fundamentals and perhaps a bit more), however, I still lack a lot of experience on the field of programming form-applications.
I have a concept for something of a Microsoft PowerPoint-like application. My problem is: I don't know how/where to start on building the framework for the GUI. When the program is running, the user should be able to drag and drop controls (text, buttons, ..) on the workspace, and my idea was to render them using reflection (does anyone know a 101 on this?).
Is there a good starter kit for building 'workspace' applications?
Your help is very much appreciated.
- A young C# programmer
-------------------------------------
Kerfeunteun!
|
|
|
|
|
Hi,
I was looking for an example of desktop ticker, i.e a scrolling bar maybe that can be launched via exe. A small windows which can display rss feeds from internet.
Thank you!
M. Nauman
"Mess with the Best, Die like the rest"
|
|
|
|
|
Perhaps this[^] (VB) article will help?
/ravi
|
|
|
|
|
Hello,
Firstly I'm very new to C# so I'll apologise in advance for what may sound like silly questions.
I'm want to write a small game application where things move on the screen. It is a turn based app and as soon as one persons turn is over the graphics update with the new position.
I understand the business logic side but as far as the visual side goes I'm not sure how graphics work in C# and would very much appreciate some pointers on where to start.
Do I draw the game board first and then overlay stuff on it? If so how? Or do I draw a game board every time a person moves?
Any help is greatly appreciated.
Thanks,
Monk
|
|
|
|
|
Monk111 wrote: I'm very new to C#
Monk111 wrote: I'm want to write a small game application where things move on the screen
These are probably mutually exclusive statements. You should learn core C# before learning extension libraries like GDI+
If the Graphics.Drawing namespace doesn't do what you want, then you need DirectX
Monk111 wrote: Do I draw the game board first and then overlay stuff on it?
Almost certainly
Monk111 wrote: If so how?
With bitmaps that havbe transparency masks, or 3D models.
Monk111 wrote: Or do I draw a game board every time a person moves?
Yes, you will have to.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Sorry I probably gave the impression that my core C# is very poor. It isn't. What I was trying to get across was that I have nvever touched on any graphics in C# so all this is very new.
Any other pointers would be helpful.....
|
|
|
|
|
Fair enough.
Well, for something turn based, you'd probably just use GDI+, unless you expect to do animations and stuff. You'd create bitmaps with, say, magenta backgrounds, and draw them on top of your background image, using the ImageAttributes class to specify that magenta is transparent. To do this, you can't store them as jpg, because jpg is lossy.
If you were to go the DX route, you'd find that there are a lot of samples in the SDK. I wrote a simple game in C#, it's presented on this site in three parts, it should give you some ideas.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Hi,
the simplest implementation is having one method that paints everything; when you wire this
to the Paint event of your Form, Panel, whatever, it will paint the initial image, and
repaint it whenever required (e.g. when another window drawn on top of it gets closed),
and also when you call Invalidate() which requests a redraw (e.g. because the other party
in the game has made a move).
For an extremely simple case, have a look at my Sokoban article.
|
|
|
|
|
Hey fellow developers,
Need help with a datagrid column...
In design time i have created a datagrid with 2 columns one is a DataGridViewComboBoxColumn type column the other is just plain text.
I am inserting data into the comboboxcolumn's items collection during runtime but when it has finished inserting into the items collection and i go to click the drop down button it does nothing.
The items are coming from a datagrids header text row.
code below;
for (i = 0; i < dataGrid.ColumnCount; i++)
{
MCForm.FileColumn.Items.Add(dataGrid.Columns[i].HeaderText.ToString());
//FileColumn is the name of the column which is set as a combobox column
}
Any idea's...
I have run through in debug mode and in the runtime properties it shows that there is items in the control but it just wont reflect back when i click the combobox button to show the items in the list.
Any help asap would be fantastic
|
|
|
|
|
Hi,
I have 6 groupBoxes with similar content. In otherwords groupBoxUnit1, groupBoxUnit2 thru groupBoxUnit6.
The number of units (1 thru 6) is entered by the user and I only want the form to display that number of units groupBoxes. For example, if there are 5 Units - display groupBoxUnit1 thru groupBoxUnit5.
I can do this with a CASE statement and a lot of typing and will be surprised if there isn't an easier alternative.
Any suggestions.
TIA
Glen Harvy
|
|
|
|
|
Put references to the controls in an array:
GroupBox[] groupBoxes = new GroupBox[] { groupBoxUnit1, ... , groupBoxUnit6 };
Now you can access them by index, so that you can loop through them and show the ones you want.
---
single minded; short sighted; long gone;
|
|
|
|
|
I thought of this but can't get my mind around it.
Can you give me some psuedo code as a hint
Glen Harvy
|
|
|
|
|
Something like this:
int visibleCount = 4;
for (int i = 0; i < groupBoxes.Length; i++) {
groupBoxes[i].Visible = (i < visibleCount);
}
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for the help - much appreciated.
Glen Harvy
|
|
|
|
|
I have a form that runs a ftp call on load (or suitable event), however when the form loads it completely freezes will the ftp call is running. Is there a straight forward way of making the form still usable while the ftp call is running? Am I looking at a asynchrous call or something like that? I sort of got what I wanted by using threading but for some reason i couldn't close the form even when the method was done executing (seems like the thread was still running (how do you stop it?)
Cheers
|
|
|
|
|
Hi,
IMO you should do networking stuff in a separate thread, so have your Load event create
and start a thread. Be careful with the GUI tho, only the main thread is supposed to
(or allowed to) access GUI components, see the InvokeRequired and Invoke/BeginInvoke
property and methods.
You can find a simple example of a thread and the Invoke stuff in my Sokoban article;
there are alternative kinds of threads (with ThreadPool, BackgroundWorker, etc).
|
|
|
|
|
hi,i have created the editor in RichTextBox control
and implemented the goto line number functionality.
now I want to find the content length of the perticular line.
Thanks
|
|
|
|