|
You setup an indexer to go through all the elements of fieldNames but you never used it to return an actual element in the array!
Try
dbConn.selectFieldNames("pragma table_info(test)")
For a = 0 To (dbConn.fieldNames.Count) - 1
cmbFieldIndex.Items.Add(dbConn.fieldNames)
Next a
Catch es As Exception
MessageBox.Show(es.Message)
End Try
Should be:
Try
dbConn.selectFieldNames("pragma table_info(test)")
For a = 0 To (dbConn.fieldNames.Count) - 1
cmbFieldIndex.Items.Add(dbConn.fieldNames(a))
Next a
Catch es As Exception
MessageBox.Show(es.Message)
End Try
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi, thanks for this, works a treat, I can't blieve I forgot to use the array.
Thanks again
John.
|
|
|
|
|
I want to develop sqlserver monitor ,tunerand analyzer please can you guide me how can i do this .. just give me a guideline .. or any opensource lib and prj u know
Features should include: Monitor SQL Server Hardware
requirements are
Utilization and Performance
Monitor CPU, memory, and the I/O subsystem percentages
Monitor disk operations (reads/writes) and network traffic
Correlate system utilization with user connections and SQL code
Diagnose Executed SQL Code Performance, Connections, and SQL Server Blocking
Analyze and chart slow performing SQL statements and stored procedures
Report the cost (Duration, CPU time, & disk reads/writes) of each statement
etc etc
R A M
|
|
|
|
|
SQL Server registers and populates a large number of performance counters - you can use the built in .NET class "PerformanceCounter" to get the current values from that for the first part of your requirement.
For the second part use the "SHOWPLAN" T-SQL commands.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
When I try to view a report inserted as Cerstal Report 11 report, LogOn Failed. I m using Orcle 8i Database.
|
|
|
|
|
I have a table with one column. This table has more than 1500 rows.
I want to print those 1500 rows of one column using 4 columns in the report(rdlc).
How is it possible?
|
|
|
|
|
This thing has driven me nuts the entire afternoon!
We have this unit to which we communicate over serialport that wants messages
in Unicode code points where C = 43, D = 44 etc.
If I want ASCII value for A i use Microsoft.VisualBasic.Asc("A") and get 65, problem is that A in Unicode is 41.
What to do??
|
|
|
|
|
|
jimithing77 wrote: A i use Microsoft.VisualBasic.Asc("A") and get 65,
As it should be. The decimal ASCII value is 65.
jimithing77 wrote: problem is that A in Unicode is 41
Not, it's not, it's 65. Convert decimal65 to hexadecimal and you get 41, or in VB notation &H41.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm sure there is a way to do it. But I don't have time to look, so I was just going to suggest that if you can't find a way, you could always write your own function that looks it up for you, like this:
Public Function GetCode(str as string) as Integer
Select Case str.Trim.ToUpper
Case "A"
Return 41
'Continue with other cases...
End Select
End Function
Or if you discover that the Microsoft.VisualBasic.Asc is consistant you could just say cint(Microsoft.VisualBasic.Asc(char)) - 24
Sorry I couldn't find a nicer answer.
|
|
|
|
|
Ah... I did think they were the same, but I didn't spot that little wrinkle when I read it, I just filed it as something to check on later.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well, consider it checked then!
Something just looked familiar, and wrong, about those two numbers the way he was describing them. I knew 65(dec) was uppercase A, but 41?? Not in any character table I've ever seen! Then I opened the ASCII chart in Visual Studio Help and the problem was staring me right in the face.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am using VB.NET (2003) to create a Windows form to interface with a SQL 2000 database. I need to validate the user input of an employee number with the table that contains the valid numbers. All I want to do is validate the information and move on, or pop a messagebox up. My problem is getting the code right to loop the array for the comparison function.
I also hope to match the USERID and integrate this into the validation process to further verify that the proper person is being identified.
Thank you in advance.
LW
LWhite
|
|
|
|
|
i don't know if this will help you but i hope it will
my suggestion is:
1. you save the use input in a variable
2. query database for that input
3. if the query result is 0 then the employee number is not exist, give warning
4. else then number is exist go to next process
I'm assuming you have a table called TabEmployees with a field called EmployeeNo and using microsoft access 2000 database file. here's the code
private function isEmpExist(byval EmpNo as integer) as boolean
dim CN as new oledbconnection
dim R as integer
cn.connectionstring="provider=microsoft.jet.oledb.4.0"
dim Cmd as oledbcommand=cn.createcommand
with cmd
'set commandtype as commandtext
.commandtext="SELECT EmployeeNo FROM TabEmployees WHERE EmployeeNo = " & EmpNo.tostring.trim
end with
r=cmd.executenonquery
if isnothing(r) then
return false
else
return true
end if
cn.close
end function
hope you find this useful, and i'm sorry if this code doesn't do as it should, but i think it will only might produce syntax error, coz i'm typing it directly here without VB. well then good luck!
|
|
|
|
|
ups sorry, i think i made mistake in that code, the line
r=cmd.executenonquery should have been
r=cmd.executescalar , sorry...
|
|
|
|
|
Thank you very much for responding. I plugged in the code and modified to match my database settings and have a syntax error. I should be able to find the error with a little troubleshooting. The error appears to be in the .CommandText line. Here is my modified code:
Private Function isEmpExist(ByVal EmpNo As Integer) As Boolean
Dim CN As New SqlConnection
Dim R As Integer
CN = (New SqlConnection("Integrated Security=False; User id= testuser; password= xxx; Server=xxx; Initial Catalog=Galley"))
Dim Cmd As SqlCommand = CN.CreateCommand
With Cmd
'set commandtype as commandtext
.CommandText = "SELECT emplid FROM users WHERE emplid = " & editEMPLID.ToString.Trim
End With
CN.Open()
R = Cmd.ExecuteScalar
If IsNothing(R) Then
Return False
Else
Return True
End If
CN.Close()
End Function
Again, I very much appreciate the assist. I've been banging my head against the wall for a few days on this one. This should be a simple comparison and validation.
LWhite
|
|
|
|
|
Hi, I have written some code that will populate 6 random numbers into 6 seprate labels, but before I can add the code to colour code these labels I need to sort the labels into accending order, as this is an assignement I have been asked to use the bubble sort. Below is a sample of the code that selects the numbers and places them into the labels then I get stuck in writing the code for the bubble sort..... any help is appreciated!!
Selects the numbers:
Dim numbers(3) As Integer
Dim counter As Integer
numbers(0) = Int(Rnd() * 49) + 1
Do
numbers(1) = Int(Rnd() * 49) + 1
Loop While numbers(1) = numbers(0)
Do
numbers(2) = Int(Rnd() * 49) + 1
Loop While numbers(2) = numbers(1) Or numbers(2) = numbers(0)
Do
numbers(3) = Int(Rnd() * 49) + 1
Loop While numbers(3) = numbers(0) Or numbers(3) = numbers(2) Or _
numbers(3) = numbers(1)
For counter = 0 To 3
'This will update the random numbers in the labels
lblLottoBall1.Text = numbers(0)
lblLottoBall2.Text = numbers(1)
lblLottoBall3.Text = numbers(2)
lblLottoBall4.Text = numbers(3)
|
|
|
|
|
A bubble sort is a nested loop. So you have two loops, each iterating over all elements and swapping an element with the one next to it, if they are in the wrong order. So, it's just two loops. You should have a go at implimenting this and if you get stuck, post the code and ask for more help.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Have a look here[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hello,
I am developing application in vb.net.In that,I used the crystal report.
In that I want to convert amount like 140 to "One Hunderd fourty"
how to convert that into crystal report?
Swapnil Bhavsar
|
|
|
|
|
if your data comes from a database then write a user defined function that takes the amount as parameter and returns the amount in words. use the this function in the select statement for retrieving the data and then display it.
May be you can write custom code in Crystal Reports, but I am not sure how to do that.
|
|
|
|
|
Hi All,
I am using a windows service to watch some folders and then process the files created in that folder. For this i am using the FileSystemWatcher. Now the problem is that i want to set the SynchronizingObject property of FileSystemWatcher, but i dont know what should be set to it. I am not using the FileSystemWatcher control, ie i have created an object am using it to watch the folders.
So please, if any one knows what value should be set to SynchronizingObject property let me know. I searched on net, but every time i saw a Form was set to the SynchronizingObject property. But how can i set a Form in a windows service ? And also what would be the use of SynchronizingObject then?
Please reply as soon as possible !
Thanks
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Anant Kulkarni wrote: i want to set the SynchronizingObject property of FileSystemWatcher, but i dont know what should be set to it.
The the SynchronizingObject just tells the FSW which thread will get the FSW events marshalled to it. It can be set to any object that implements the ISynchronizeInvoke interface. You can easily tell this if the object you want as the SynchObject has a BeginInvoke method.
Basically, if the FSW is created on a seperate thread from the the that's going to handle the events that FSW raises, you need to set the SynchronizationObject .
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
When a system event occurs I want to bring my application to the front of all other active windows and give it focus.
I've just used the me.activate() command.
This works fine on my XP machine, but on a 2000 machine, the application is not brought to the front, the icon just flashes in the task bar.
Any ideas on what I might be doing wrong here??
|
|
|
|
|
It's doing exactly what you told it to do.
If you read the documentation on Form.Activate() method, you find that it says: "Activating a form brings it to the front if this is the active application, or it flashes the window caption if this is not the active application."
You're probably looking for the AppActivate() method of the Interaction class, buried in the Microsoft.VisualBasic namespace. Docs on it are here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|