|
Why will it break ?
With the solution i currently have, if the user puts 11(November) and 2 for the span, i get the following numbers, after a little math :
9,10,11,12,1
Then i just make an SQL like "WHERE MONTH IN (9,10,11,12,1)"
It actually works now.
|
|
|
|
|
Find out the months that you want to select, from your example, -1, 0, 1, 2, 3. Then check for lower and upper boundaries, add or minus 12 accordingly. So in your example they would be 11, 12, 1, 2, 3.
Then Select Where Month In (11, 12, 1, 2, 3).
|
|
|
|
|
Yeah that gave my brain a start.
Solved.Thanks
|
|
|
|
|
I am creating an application that will get the CPU utilization for each process similar to the TaskManager. I have created the listing below. When the procedure prints out to a console window the CPU percent is always zero. When I debug the code and step through the code line by line the procedure prints the correct CPU percentage. Why does running the code does not work? While stepping through the code works? Thanks for any help.
Dim poc() As Process = Process.GetProcesses()
Dim PCounter As New PerformanceCounter
PCounter.CategoryName = "Process"
PCounter.CounterName = "% Processor Time"
For i As Integer = 0 To poc.Length - 1
If poc(i).ProcessName.ToString <> "system" Or poc(i).ProcessName.ToString <> "idle" Or poc(i).ProcessName.ToString <> "svchost" Then
Try
'PCounter.InstanceName = "_Total"
PCounter.InstanceName = poc(i).ProcessName
Console.WriteLine(PCounter.NextValue.ToString & " " & poc(i).ProcessName & " " & poc(i).MainModule.FileName & " " & poc(i).MainWindowTitle)
Catch ex As Exception
'Console.WriteLine(poc(i).ProcessName.ToString & " " & ex.Message)
End Try
End If
Next
modified on Tuesday, December 29, 2009 11:52 AM
|
|
|
|
|
Maybe because it takes time to step through the code, and in that time, the processes have an opportunity to accumulate some data, as opposed to writing it immediately to the console.
Try writing it to the console once per second.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Thanks for the direction. I put a Sleep method in the code
dblCPU = PCounter.NextValue.ToString
Sleep(1)
dblCPU = PCounter.NextValue.ToString
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
|
|
|
|
|
Ummm, the Threading.Thread object has a Sleep method in it. Also, I think I remember seing somewhere that setting anything less that 25 millsecs results in a sleep period of 25 millisecs.
Lastly, if someone helps you here and provides the right answer (or a good one) vote the answer as a good answer.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
what is the best Lateral program for make installer that is better and more Supple???
M.Alizadeh
|
|
|
|
|
.Net lets you create set up and deployment projects for your application. You can also read about ClickOnce deployement in case it suites your application.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
.Net setup and Deployment /Click Once is the best and you can also use Install shield but will prefer
.Net setup
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Dear All
Anybody explain, i have two defrend databse (Foxpro,Sql). i have two table in defrend databse thats are same manner.One table all datas pick one DataSet , now i want simply to insert this Datset to Other Databse Table.
i want Only without Useing Loops. is it Possible...?
Kindly reply Me...
Thanx For advance
|
|
|
|
|
SSIS would have been a good choice here. Although you can also do this using the SqlBulkCopy class in case you are inserting data into the SQL database.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
thanx for Your Valuable Information.
Dear frnd is it Posiible to Accssdatabase table also..?
supose i have one dataset thats insert into AccssDatabase..is it possible...
Kindly reply me
|
|
|
|
|
I guess you would connect to the access table through OleDb which does not provides a BulkCopy class. So, your best bet, IMO, would be to have a stored procedure or a bulk insert SQl statement which will take in the array of values or the datatable itself as a parameter and perform the insert.
Since I have not used Access, I am not sure writing such stored procedure in it is possible or not. But I am sure google will help with that.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
thanx for your valuable information...
if u get any solution pls foraward me...
shamsubava@gmail.com
|
|
|
|
|
Thanks in Advance
I want to change System Short Date Format to "dd-MM-yyyy" , Already Goggled and tried even on CP but all in vain , i tried this code but its not working even
Dim reg As RegistryKey
reg = Registry.Users.OpenSubKey("S-1-5-21-1757981266-861567501-682003330-500\Control Panel\International", True)
If Convert.ToString(reg).Trim = String.Empty Then
MsgBox("Invalid")
Else
reg.SetValue("sShortDate", "dd/MM/yyyy")
reg.SetValue("sLongDate", "dd/MM/yyyy")
End If
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Check this[^] article. Might help.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
its in VB6
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Yes. But all it does is to call some methods in kernel32. You can do the same through .Net as well.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
S0FTDEV wrote: dd-MM-yyyy
Just to make sure that this is just a typo, you are trying to set your date format to dd-MM-yyyy, but your code sets it to dd/MM/yyyy.
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
"dd-MM-yyyy" is not the problem actually it changes the Registry value to "dd/MM/yyyy" or "dd-MM-yyyy" but in regional settings the date format still remains the same
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I am learning visual basic, i have asked questions before and got great answers and oping for a little bit of help again if no one is busy
I am a trainee web designer/developer and have my own website, which i am currently designing. Now i have planned it all out and wish to create a Visual Basic.NET program.
I wish for both the website and the program to have the same logins, both using a MySql database. The website is using a simple script by me for the login at the moment. I didn't want to over complicate it, till i have the Vb program connecting to the database too.
Heres a simple breakdown:
1. Both website and program use same login credentials and same MySql database.
2. Visual Basic program connect remotely to the Mysql database. ( with a shared host )
The program would go about it by basicly starting with a mysql connection then, accessing both username and password tables and checking is Username.TEXT & Password.TEXT match with the database. Once matches, then load up Mainfrm
Sorry for the big message. I have did research on how i would go around doing this. Nothing i can find suggests how i could connect to a remote database on a shared host with (cPanel)
Some of the code im using just now to open the connection, but not sure how to connect to my databse :
Dim connect As New MySqlConnection
Dim sqlcommands As New MySqlCommand
Dim myConnString As String
Dim UserID As Integer
myConnString = "server=" & My.Settings.HostIP & ";" _
My.Settings.HostIP - code i have put in settings file all it contains is my website which doesn't work, of course hehe XD
I have the import mysql client.
Any help would be great thanks. Ofc im not asking someone to do all the work, just asking for some help or ways to improve what i have.
|
|
|
|
|
This tutorial can help you [^]
If you still have errors (after properly initializing the connection string), you should also create mysql user in cPanel and grant connect to the database right.
|
|
|
|
|
Thanks for the reply, the tutorial looks very helpful. Just about to go read it
|
|
|
|