|
You still haven't come up with a specific problem you just want someone to rewrite the code to to use an SQL data provider instead of a JET provider.
I suggest that you break down your code into its functional blocks, and go read the documentation relating to System.Data namespace and the classes within, such as the SQLConnection, SQLCommand, SQLDataAdapter, SQLDataReader etc.
|
|
|
|
|
Does anyone with a friend ?
Me into your code by .
thank you.
|
|
|
|
|
miladbiranvand wrote: Does anyone with a friend ?
Me into your code by .
thank you
What? That's jibberish.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Take a look at this[^].
It is a tutorial on the process of converting ADO to ADO.Net.
Give it a try, and come back with specific questions about anything you cannot get to work.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
code is
Public Class Form1
Public DsCenter As New DataSet
Public Count As Integer = 1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FillDsCenter()
LoadTV()
End Sub
Public Sub FillDsCenter()
Dim StrSql As String
Dim da As New OleDbDataAdapter
If Con.State = ConnectionState.Closed Then
Con.Open()
End If
StrSql = "SELECT * FROM Folder"
da = New OleDbDataAdapter(StrSql, Con)
DsCenter.Clear()
da.Fill(DsCenter, "tbl")
Con.Close()
End Sub
Private Sub LoadTV()
Dim K, I, J, L As Integer '1
Dim T, R, Pr As String '2
Count = 1 '3
For I = 1 To DsCenter.Tables("tbl").Rows.Count '4
K = DsCenter.Tables("tbl").Rows(Count - 1).Item("Level") '5
If J < K Then J = K '6
If Not (Count = DsCenter.Tables("tbl").Rows.Count) Then Count += 1
Next 'ok
Count = 1 'ok
For I = 0 To J 'ok
Count = 1 'ok
For L = 1 To DsCenter.Tables("tbl").Rows.Count 'ok
K = DsCenter.Tables("tbl").Rows(Count - 1).Item("Level") 'ok
T = DsCenter.Tables("tbl").Rows(Count - 1).Item("head") 'ok
R = DsCenter.Tables("tbl").Rows(Count - 1).Item("ID") 'ok
Pr = DsCenter.Tables("tbl").Rows(Count - 1).Item("Parent") 'ok
If I = 0 And K = 0 Then 'ok
TV.Nodes.Add(R, T, "bc", "bo") 'ok
Else 'ok
If K = I Then 'ok
TV.Nodes.Find(Pr, True)(0).Nodes.Add(R, T, "gc", "go") 'ok
End If 'ok
End If 'ok
If Count <> DsCenter.Tables("tbl").Rows.Count Then Count += 1
Next
Next
'*** table matn
'Count = 1
'For I = 1 To DsCenter.Tables("tbl").Rows.Count
' K = DsCenter.Tables("tbl").Rows(Count - 1).Item("Folder")
' R = DsCenter.Tables("tbl").Rows(Count - 1).Item("ID")
' T = DsCenter.Tables("tbl").Rows(Count - 1).Item("Head")
' TV.Nodes.Find("F" & K, True)(0).Nodes.Add("M" & R, T, "mc", "mo")
' If Count <> DsCenter.Tables("tbl").Rows.Count Then Count += 1
'Next
End Sub
|
|
|
|
|
Hello Experts,
I want result in this format->Smart/Kidya.
where,
Str1=Smart
Str2=Kidya
How to do with VB.Net?
|
|
|
|
|
Dim str3 as string = str1 + "/" + str2
|
|
|
|
|
Are you serious?
This is such a beginner-level question and you have been around these forums for some time now. I find it hard to believe that you do not know how to do this.
Still.
There are several ways to do this.
You could use the String.Concat() method, look up the documentation.
You could use a StringBuilder instance with the Append() method, again, look up the documentation.
You could simply use the & operator or the + operator, LUTD.
There are many, many more ways but I think these are the most common.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
There are different ways;
The simplest is;
Dim x As String = "Fred"
Dim y As String = "Smith"
Dim z As String
z = x + "/" + y
or
Dim x As String = "Fred"
Dim y As String = "Smith"
Dim z As String
z = x & "/" & y
If you look up the string class in the documentation, there are others ways to do this also; including, concat, join.
You can also use a stringbuilder like;
Dim newString As New System.Text.StringBuilder
newString.Append(x)
newString.Append("/")
newString.Append(y)
Debug.WriteLine(newString)
|
|
|
|
|
VB.NET has the almighty & operator for problems like this.
It it too bad there are no books nor on-line documentation to tell you that.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
HELLO ALL;
Does anybody have idea how to do Natural order sorting in vb
e.g.
If i ahev entries like
1
2
11
111
A
AA
B
then it sors like
1
11
111
2
A
AA
AAA
B
So do u have any idea how to implement natural sort?
Thanx in advance
|
|
|
|
|
As you see, the sorting take in consideration the word lenght, so to get a "Natural" sorting you can formatting all the worlds to have the same lenght by concatenating 0 before each word.
For example, if you have
1
2
11
111
A
AA
B
so format them as following:
001
002
011
111
00A
0AA
00B
and now sort.
Hope it helps
Shay Noy
|
|
|
|
|
You can rely on Windows Explorer to do it for you, see here[^].
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Thanx for the quick reply
I thought of padding but there can be a seperator
e.g
A - 1
1 * A
2 # 5
which makes dificult to sort
do u have any idea what can be the solution in this case?
Thanx
|
|
|
|
|
either the items are valid file names and I gave you the answer already, or they aren't and you have to write code to do it yourself.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Thanx Luc
I will try with P/invoke
if that doesnt solve the problem then manual sorting is the the best option
Thanx once again
|
|
|
|
|
Good Day All
I am working on a research project and stuck on a few things, one being how to get the memory footprint of operations run within a system.
I created (or busy creating) a system that runs a few techniques of some sort.
Once a technique is run, I would like to gather a few parameters from it.
The parameters are the ratio of the file size (already get this information), the time taken to run technique (already have this too), and the amount of memory the technique used when running (the problem).
I need some assistance with this if anyone knows the procedure in which best to get the amount of memory something uses when its run, and how to then get the memory usage.
Can someone please assist?
Thanks in advance!
|
|
|
|
|
Can you not use the diagnostics name space to query the process counters memory utilisation for your application?
Don't know how accurate it would be, but at least it is a start!
|
|
|
|
|
hi,
I have tried this and am sure i have done this before however i cannot think of the code needed.
All i want to do is copy the contents of textbox1 in form1 into textbox2 into form2
i am using a timer on form2. so on form2 load this is the code
i thought the code was textbox2.text = my.forms.form1.textbox1.text
however this does not work
please help me
thanks
|
|
|
|
|
I take it then you are wanting the code to be run in Form2 (on a button push for example, to retrieve the contents of form1.textbox1? as opposed to the form1 setting the text box on form2?
|
|
|
|
|
The code below will check the application open forms collection to make sure it is open, then it will copy the text across. You could modify this to raise an error/message to the user to say the form is not open etc.
Dim otherForm As Form1
For Each item As Form In My.Application.OpenForms
If item.Name = "Form1" Then
otherForm = item
TextBox1.Text = otherForm.TextBox1.Text
Exit For
End If
Next
|
|
|
|
|
thanks Dave for the reply!!
I tried your code however it didn't seem to copy the contents of textbox1 in form1 into textbox2 in form2?
I am using a timer, what i am initailly doing is checking the serial of the computer in one text box and then comparing it with another one in another form.
|
|
|
|
|
I don't know the specifics of what you are trying to do or where the timer is residing etc.
The code does work if placed in a button event on Form2 and you have both forms (with names Form1 and Form2) open, and your textboxes are both named textbox1 on each form
Would need to know more about your specific scenario to write code for what your trying to achieve, but surely with the information i have provided you can work out what is going on and solve you specific problem?
|
|
|
|
|
hi, expert
I want to export my all data listview control into pdf file.
ex. suppose i fetch my all data from database into listview and after that i want to export all data into pdf file formate in vb.net.
i hope u understand my querry.
|
|
|
|