Click here to Skip to main content
15,919,028 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to load and unload DLL or Plugins in VB.NET2005? Pin
rattlesnake3162-Sep-07 17:14
rattlesnake3162-Sep-07 17:14 
AnswerRe: How to load and unload DLL or Plugins in VB.NET2005? Pin
originSH3-Sep-07 0:02
originSH3-Sep-07 0:02 
QuestionDatagrid Relationship Pin
alzaabi20xx2-Sep-07 12:27
alzaabi20xx2-Sep-07 12:27 
AnswerRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd2-Sep-07 21:15
professionalVimalsoft(Pty) Ltd2-Sep-07 21:15 
GeneralRe: Datagrid Relationship Pin
alzaabi20xx3-Sep-07 9:37
alzaabi20xx3-Sep-07 9:37 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd3-Sep-07 20:42
professionalVimalsoft(Pty) Ltd3-Sep-07 20:42 
GeneralRe: Datagrid Relationship Pin
alzaabi20xx3-Sep-07 21:58
alzaabi20xx3-Sep-07 21:58 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd3-Sep-07 22:22
professionalVimalsoft(Pty) Ltd3-Sep-07 22:22 
Dear alzaabi20xx

its my plesure to help you.
|alzaabi20xx wrote:
ok then i made my Database using MS Access and my tables order as following:


----------------------------------------------------
tblContacts:                  Attendance
----------------------------------------------------
ID (PK)    "Text"           EmpID "Text
FirstName  "Text"           DDate "Date/Time
SurName    "Text"



When you Create a Relation in two tables, there must be a Primary Key for each table and a foreign key. e.g

-----------------------------------------
Customer                Products
============         +++++++++++++
CustomerID(PK)        Product_ID(PK) 
CustomerName          Product_Name
Product_ID(FK)        Product_Descreption


The Above will be possible with Relations Product_ID is the Primary key of the Products table and a Foreign key in the Customer table.

The Following code will help you understand.
' Open a database connection.
Dim strConnection As String = _
   "Data Source=localhost;Initial Catalog=Northwind;" _
   & "Integrated Security=True"
Dim cn As SqlConnection = New SqlConnection(strConnection)
cn.Open(  )
 
' Set up a data adapter object.
Dim strSql As String = "SELECT * FROM Customers" _
   & " WHERE City = 'Buenos Aires' AND Country = 'Argentina'"
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
 
' Load a data set.
Dim ds As DataSet = New DataSet(  )
da.Fill(ds, "Customers")
 
' Set up a new data adapter object.
strSql = "SELECT Orders.*" _
   & " FROM Customers, Orders" _
   & " WHERE (Customers.CustomerID = Orders.CustomerID)" _
   & "    AND (Customers.City = 'Buenos Aires')" _
   & "    AND (Customers.Country = 'Argentina')"
da = New SqlDataAdapter(strSql, cn)
 
' Load the data set.
da.Fill(ds, "Orders")
 
' Close the database connection.
cn.Close(  )
 
' Create a relation.
ds.Relations.Add("CustomerOrders", _
   ds.Tables("Customers").Columns("CustomerID"), _
   ds.Tables("Orders").Columns("CustomerID"))

When you bind the Datagrid, you are going to use "CustomerOrders" the name of the relation.

If you dont understand you will tell me.
MR alzaabi20xx we take it step by step, next we will update. try this First.






Vuyiswa Maseko,

Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding

VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com


GeneralRe: Datagrid Relationship Pin
alzaabi20xx4-Sep-07 4:13
alzaabi20xx4-Sep-07 4:13 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd4-Sep-07 4:22
professionalVimalsoft(Pty) Ltd4-Sep-07 4:22 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd4-Sep-07 21:14
professionalVimalsoft(Pty) Ltd4-Sep-07 21:14 
GeneralRe: Datagrid Relationship Pin
alzaabi20xx4-Sep-07 23:57
alzaabi20xx4-Sep-07 23:57 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd5-Sep-07 0:07
professionalVimalsoft(Pty) Ltd5-Sep-07 0:07 
QuestionInvoke event inside Flash ActiveX in VB Pin
sunco2-Sep-07 10:06
sunco2-Sep-07 10:06 
AnswerRe: Invoke event inside Flash ActiveX in VB Pin
Dave Kreskowiak3-Sep-07 4:36
mveDave Kreskowiak3-Sep-07 4:36 
QuestionAccessing exchange server public folders Pin
manisghouri2-Sep-07 8:49
manisghouri2-Sep-07 8:49 
QuestionGetting the outermost Document object in webbrowser control Pin
Ahmad Zaidi2-Sep-07 4:10
Ahmad Zaidi2-Sep-07 4:10 
QuestionDatagridView row selection Pin
Mr Oizo2-Sep-07 3:13
Mr Oizo2-Sep-07 3:13 
AnswerRe: DatagridView row selection Pin
Widgets2-Sep-07 14:52
Widgets2-Sep-07 14:52 
Questionplease help me with combobox keycode Pin
bapu28892-Sep-07 2:16
bapu28892-Sep-07 2:16 
AnswerRe: please help me with combobox keycode Pin
Lucky Sheikh6-Sep-07 20:40
Lucky Sheikh6-Sep-07 20:40 
QuestionReplace multiple space with Single space in RichTextBox Pin
Rupesh Kumar Swami2-Sep-07 2:11
Rupesh Kumar Swami2-Sep-07 2:11 
AnswerReplace multiple space with Single space in RichTextBox Pin
Chatura Dilan2-Sep-07 3:24
Chatura Dilan2-Sep-07 3:24 
AnswerRe: Replace multiple space with Single space in RichTextBox Pin
Luc Pattyn2-Sep-07 4:04
sitebuilderLuc Pattyn2-Sep-07 4:04 
Questioncombobox questions Pin
xebe2-Sep-07 0:11
xebe2-Sep-07 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.