Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how refer to table location in DB design sample (Read 1671 times)
gokul
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: Sep 2nd, 2006
how refer to table location in DB design sample
Sep 18th, 2006 at 2:57am
Print Post  
I am using flowchart.Net sample DBdesing and using Assemblies for .NET 2.0.
in this sample there is inbuild function Arrange
ex. tl.Arrange(fc) and u have used it in DBdesign for arranging tables.
insted of arranging tables in one line i want to arrange tables in my own manner. so i made follwing changes but its not working.i m sending my source code.second thing i have removed tl.arrange(fc) and made follwing changes in DBdesing


'Plese note some line have commented in sample code.code has been developed in .net 2005


Dim cf As ConnectionForm = New ConnectionForm()
   Dim x, y, tblcount, wdth, hgt As Integer
   Dim tbl As Table
   x = 250
   y = 150
   wdth = 100
   hgt = 120
   tblcount = 1
   cf.tbConnect.Text = _
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\db\swadesh.mdb;Persist Security Info=False;"
   If cf.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return

   Try
  Dim cn As OleDbConnection = New OleDbConnection
  Dim schemaTable As DataTable

  ' connect using specified connection string
  cn.ConnectionString = cf.tbConnect.Text
  cn.Open()

  ' retrieve schema information about tables.
  ' because tables include tables, views, and other objects,
  ' restrict to just TABLE in the Object array of restrictions.
  schemaTable = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _
     New Object() {Nothing, Nothing, Nothing, "TABLE"})

  'iterate tables
  Dim i As Integer
  For i = 0 To schemaTable.Rows.Count - 1
     If tblcount = 1 Then ' parent table 
     tbl = New Table(fc.CreateTable(x, y, wdth, hgt))
     x = x + 150
     ElseIf tblcount Mod 2 = 0 Then 'right side tables 
     tbl = fc.CreateTable(x, y, Width, Height)
     'tbl.FitSizeToImage()
     x = x - 300
     ElseIf tblcount Mod 2 <> 0 Then 'left side table 
     tbl = fc.CreateTable(x, y, 100, 120)
     'tbl.FitSizeToImage()
     y = y - 125
     End If
     fc.Add(tbl)
     'tbl.
     tbl.Caption = schemaTable.Rows(i).ItemArray(2).ToString()
     tbl.BoundingRect = New RectangleF(0, 0, 35, 50)
     ' get columns
     Dim cmd As OleDbCommand = New OleDbCommand
     Dim tblInfo As DataTable
     Dim reader As OleDbDataReader

     ' retrieve schema from the table into a DataReader
     cmd.Connection = cn
     cmd.CommandText = "SELECT * FROM " + tbl.Caption
     reader = cmd.ExecuteReader(CommandBehavior.KeyInfo)

     ' Retrieve column schema into a DataTable.
     tblInfo = reader.GetSchemaTable()
     tbl.RedimTable(2, 0)

     ' for each field in the table...
     Dim r As Integer = 0
     Dim field As DataRow
     For Each field In tblInfo.Rows
     tbl.AddRow()

     ' that's the name of the columns
     tbl(0, r).Text = field(0).ToString()

     ' that's a .NET type, not DB one; skip 'System.'
     Dim dotnetType As String = field(5).ToString()
     tbl(1, r).Text = dotnetType.Substring(7)

     r += 1
     Next field

     ' Always close the DataReader and connection.
     reader.Close()
     tblcount = tblcount + 1
  Next i

  ' explicitly close - don't wait on garbage collection.
  cn.Close()

  ' TODO: read relations

  'Dim tl As MindFusion.FlowChartX.LayoutSystem.TreeLayout = _
  'New MindFusion.FlowChartX.LayoutSystem.TreeLayout
  'tl.NodeDistance = 80
  'tl.Arrange(fc)


   Catch ex As Exception
  MessageBox.Show(ex.Message)
   End Try
    End Sub
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how refer to table location in DB design sampl
Reply #1 - Sep 18th, 2006 at 6:14am
Print Post  
What exactly is not working - loading the tables or arranging them? Could you post a screenshot showing what the layout should look like?

Thanks
« Last Edit: Sep 18th, 2006 at 3:24pm by Stoyo »  
Back to top
 
IP Logged
 
gokul
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: Sep 2nd, 2006
Re: how refer to table location in DB design sampl
Reply #2 - Sep 19th, 2006 at 3:02am
Print Post  
i found another way to solve my problem thanks
looking forward for further support
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint