Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2007, 11:42 PM
Authorized User
 
Join Date: May 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to MathLearner
Default TableCreation using vb in runtime

Hi
        please expln me or send me one example .. To create a table in runtime using textfile..
                 Help Me..

 
Old May 16th, 2007, 12:06 AM
Registered User
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to hymavathy_kr
Default

u can use the below coding


=========================================
Dim dbs As Database
Dim rsReel As New ADODB.Recordset
Dim sql, sql1 As String
Dim i, j As Integer
Dim TableAvilable As Boolean

Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command


    cnn.ConnectionString = dbconn
    cnn.Open
    cmd.ActiveConnection = cnn

    Set dbs = OpenDatabase(DBF_Path)
        For i = 0 To dbs.TableDefs.Count - 1
            If dbs.TableDefs(i).Name = "TmpGsm" Then
                dbconn.Execute "Delete from TmpGsm"
                TableAvilable = True
                Exit For
            Else
                TableAvilable = False
            End If
        Next
        dbs.Close

    If TableAvilable = False Then
        cmd.CommandText = "create table TmpGsm (frm_gsm1 number, to_gsm1 number,frm_gsm2 number, to_gsm2 number,frm_gsm3 number,to_gsm3 number,frm_gsm4 number,to_gsm4 number,above number)"
        cmd.Execute
        cnn.Close
    End If
    dbconn.Close
    dbconn.Open

 
Old May 16th, 2007, 12:49 AM
Authorized User
 
Join Date: May 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to MathLearner
Default

Thank u for ur help..







Similar Threads
Thread Thread Starter Forum Replies Last Post
Java without runtime? WIND Pro Java 2 October 1st, 2007 05:29 AM
How to get control in runtime. Somesh .NET Framework 2.0 1 March 7th, 2007 03:42 PM
Runtime access to AdobePhotoshop 7.0., with VB.Net Samatha Pro VB.NET 2002/2003 0 December 15th, 2006 03:05 AM
runtime error??? jeffreyJS ASP.NET 2.0 Basics 4 September 14th, 2006 04:07 AM
Running a Cross-tab report @ runtime in VB antukin Pro VB Databases 0 August 20th, 2003 03:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.