|
I am using vb6.0 for my application and connect to ms access 2000 database. I have 2 tables, table1 and table2. table1 is the parent and table2 is dependent on table1. for example, table1 has these columns, a1,a2,a3,a4,a5,a6,a7 and table2 has a1,a2,b1,b2,b3,b4,b5. a1 and a2 are the primary keys hence they link the two tables. the relationship is 1-many. now i have i form in vb and i want a uqery that is when i supply a parameter to search for, it has to look in both tables and display the results in 1 form but from two tables, table1 and table2. In access this is not a problem since i can create two forms based on the tables and then let the other form be a parent and the other a child, but in vb, I have no idea.
Can anyone help.
phokojoe
|
|
|
|
|
hi there,
u need to have sql query foundation.
to query from more than 2 tables, u might to use the JOINT clause
for more information, u can read from MS SQL Online book
<< >>
|
|
|
|
|
Selecting from multiple tables requires more grip on SQL.
I have simplest way which I mostly apply when I use Access for Backhand.
In access, establish relationship between tables. You might me aware.
Run Query Wizard.
Select Both tables in the query window.
In the bottom grid select desired fields form desired table.
Run the query will give you some result about selected or filtered data.
In the View Menu, Choose SQL View.
SQL Query in the standard format will appear in a textfield to copy it to any where.
This query can be used in ADO.
|
|
|
|
|
Look at the following Code:
---From here---
Private Timer_Tick(ByVal sender a System.Object,ByVal e as Eventargs) handles Timer.Tick
TickerManagement()
End Sub
---To here---
My question is how to execute this code inside a seprate thread.
|
|
|
|
|
I would suggest that first you create a class that encapsulates the code necessary to create and manage the thread, then use a System.Timer instead of a Form timer.
|
|
|
|
|
How to open a password protected database from the Server Explorer in Visual Studio .NET, when i am trying to make a connection to a password protected database, it gives the following error msg:
'Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user.'
Now i have made a Workgroup information file but it still giving this error what will be the true way to make a successfull connection with a password protected database.
|
|
|
|
|
Connection strings to Access database. Taken from www.connectionstrings.com!
Standard security:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"
Workgroup (system database):
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:System Database=system.mdw;"
With password:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"
|
|
|
|
|
I am a beginners in dotnet.
I have one datagrid.Retrieve the data from the db and bind into a datagrid.
Now i want to edit and update the data in a datagrid.
And also filter the records in a grid based on some conditions.
how its possible any one know this plz helpme.
|
|
|
|
|
As far as filtering goes try using as DataView for your Datagrid.
Make sure the DataGrid is not set to readonly.
If your using a DataAdapter to retrieve data, verify there is an Update command defined, then use the Update method to write back to the database.
|
|
|
|
|
hi
i want to know what is the difference b/w socket programming in desktop and on the pda. the ports are same or the pda had not ports for socket programming .
ddd
|
|
|
|
|
There is no difference. Sockets are sockets are sockets. Berkley is pretty much a standard implementation.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok u mean that socket programming is possible in pda and sockets present in the desktop ie 1024 onward are also present in pda.
ddd
|
|
|
|
|
Hai i am beginners in dotnet.I want to add toolbar in datagrid using vb.net and also add edit delete operation are done in datagrid.
I need some suggestion abt this.
Any one know send reply to me
|
|
|
|
|
How can I use the OpenFileDialog or CloseFileDialog dialogs to select a floder but not a file (like we did with DirList in VB6)?
Thanks
James
|
|
|
|
|
|
Hi guy's
Does any body can help me please ? I have created an Visual Basic.Net Application and in my application there is one form which was contains crystal report viewer that form called Report Form, At the first time when I run this program in my PC everything was OK, but after I created Setup disk and install it into another PC , I got errror message " Load Report Failed " every time I run That Report form.
I don't know how it come and what should I do to fixed it. I really need your help to solve my problem.
Thank you
Best regards
I C E
|
|
|
|
|
1. Did you include the report in the installation?
2. Is the report sitting in the directory where your code expects it to be?
3. Is your code generating the correct full path to the report file or did you just assume that the current directory would be your applications directory?
BTW, #3 this is the most popular mistake in using any file! Always generate full pathnames to any file you use. Never(!!) assume that the current directory will be what you set it to, or assume it to be, at any time! I can't stress this enough!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a recursive query which fetches a heirachy for me. now i want to show that heirachy in a tree view.
The problem in showing it in a treeview is that it is adding only one child in the parent. If there child itself is a parent then a new node is created instead of adding it in the existing node.
like this
1->2
2->3
3->4
4->5
and i want something like this
1->2->3->4->5
Can anyone Help?
|
|
|
|
|
Post the code that populates the TreeView. You're not properly tracking which node your adding children too.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have solved it Here's the code:
Protected Function RecursiveQuery(ByVal ParentID As String)
Dim strSelect As String
strSelect = "select R.RE_Child,D.RE_entities_Name as Child from Relation_Detail R,Relation_Master D where R.RE_Child=D.Relation_Master_code and RE_Parent='" & ParentID & "'"
Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection("workstation id=localhost;packet size=4096;user id=sa;data source=localhost;persist security info=False;initial catalog=Test")
Dim sqcmdRecursive As SqlCommand = New SqlCommand(strSelect, con)
Dim strParentID As String
Dim strChildID As String
Dim sqrd As SqlDataReader
Dim tvCreate As TreeNode
Try
If con.State = ConnectionState.Closed Then
con.Open()
End If
sqrd = sqcmdRecursive.ExecuteReader
While sqrd.Read
arParent.Add(ParentID)
strChildID = sqrd.Item(0)
If ParentID.Equals("0") Then
ParentNode = New TreeNode(ParentID).Nodes.Add(sqrd.Item(1))
ParentNode.Tag = sqrd.Item(0)
PasteImages(ParentNode, sqrd.Item(0))
TreeView1.Nodes.Add(ParentNode)
ElseIf shFlag = 1 Then
ParentNode = New TreeNode(ParentID)
Dim NewNode As TreeNode
NewNode = New TreeNode(sqrd.Item(1))
NewNode.Tag = sqrd.Item(0)
PasteImages(newnode, sqrd.Item(0))
Add2Node(TreeView1.Nodes, ParentNode, NewNode)
Else
ParentNode = New TreeNode(ParentID)
Dim NewNode As TreeNode
NewNode = New TreeNode(sqrd.Item(1))
NewNode.Tag = sqrd.Item(0)
PasteImages(newnode, sqrd.Item(0))
Add2Node(TreeView1.Nodes, ParentNode, NewNode)
End If
RecursiveQuery(sqrd.Item(0))
End While
Catch ex As Exception
MsgBox(ex.ToString)
Finally
con.Close()
shFlag = 1
End Try
End Function
Private Function Add2Node(ByVal TestNode As TreeNodeCollection, ByVal findnode As TreeNode, ByVal newnode As TreeNode) As Boolean
Dim n As TreeNode
For Each n In TestNode
If n.Tag = findnode.Text Then
n.Nodes.Add(newnode)
Add2Node = True
Exit Function
End If
Add2Node(n.Nodes, findnode, newnode)
Next
End Function
|
|
|
|
|
I have solved the problem. Here's the code:
Protected Function RecursiveQuery(ByVal ParentID As String)
Dim strSelect As String
strSelect = "select R.RE_Child,D.RE_entities_Name as Child from Relation_Detail R,Relation_Master D where R.RE_Child=D.Relation_Master_code and RE_Parent='" & ParentID & "'"
Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection("workstation id=localhost;packet size=4096;user id=sa;data source=localhost;persist security info=False;initial catalog=Test")
Dim sqcmdRecursive As SqlCommand = New SqlCommand(strSelect, con)
Dim strParentID As String
Dim strChildID As String
Dim sqrd As SqlDataReader
Dim tvCreate As TreeNode
Try
If con.State = ConnectionState.Closed Then
con.Open()
End If
sqrd = sqcmdRecursive.ExecuteReader
While sqrd.Read
arParent.Add(ParentID)
strChildID = sqrd.Item(0)
If ParentID.Equals("0") Then
ParentNode = New TreeNode(ParentID).Nodes.Add(sqrd.Item(1))
ParentNode.Tag = sqrd.Item(0)
PasteImages(ParentNode, sqrd.Item(0))
TreeView1.Nodes.Add(ParentNode)
ElseIf shFlag = 1 Then
ParentNode = New TreeNode(ParentID)
Dim NewNode As TreeNode
NewNode = New TreeNode(sqrd.Item(1))
NewNode.Tag = sqrd.Item(0)
PasteImages(newnode, sqrd.Item(0))
Add2Node(TreeView1.Nodes, ParentNode, NewNode)
Else
ParentNode = New TreeNode(ParentID)
Dim NewNode As TreeNode
NewNode = New TreeNode(sqrd.Item(1))
NewNode.Tag = sqrd.Item(0)
PasteImages(newnode, sqrd.Item(0))
Add2Node(TreeView1.Nodes, ParentNode, NewNode)
End If
RecursiveQuery(sqrd.Item(0))
End While
Catch ex As Exception
MsgBox(ex.ToString)
Finally
con.Close()
shFlag = 1
End Try
End Function
Private Function Add2Node(ByVal TestNode As TreeNodeCollection, ByVal findnode As TreeNode, ByVal newnode As TreeNode) As Boolean
Dim n As TreeNode
For Each n In TestNode
If n.Tag = findnode.Text Then
n.Nodes.Add(newnode)
Add2Node = True
Exit Function
End If
Add2Node(n.Nodes, findnode, newnode)
Next
End Function
|
|
|
|
|
I have an existing form I created from vb studio and I am working on how to update and fill an access database from the text fields when the user clicks the submit button. Help please
|
|
|
|
|
This is such a common task, that I doubt you'd have any trouble searching google for articles on it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
VB6, VB.NET (1.0 or 2.0)?
In any case the official documentation on CD (or MSDN on-line) has plenty of examples and ready to use code about that.
|
|
|
|
|
I need code for creating a TCP/IP communication inside visual basic adding the Winsock control so that you acan chat on a port
|
|
|
|