Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I want to create a table at runtime with create table sql command in vb6. Can someone help me as to how to pass text entered at runtime in a textbox to create table command?Raju

Dim SQL as String
SQL = "CREATE DATABASE [" & txtDatabaseName.Text & "] ON (NAME = N'" & txtDatabaseName.Text & "_dat', FILENAME = N'" & txtPathToDatabase.Text & txtDatabaseName.Text & ".mdf' , SIZE = 175, FILEGROWTH = 10%) LOG ON (NAME = N'" & txtDatabaseName.Text & "_log', FILENAME = N'" & txtPathToLog.Text & txtDatabaseName.Text & ".ldf' , SIZE = 7, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS"This assumes that you have 3 text boxes:
txtPathToDatabase
txtPathToLog
txtDatabaseNamethe PathToDatabase and PathToLog can be prefilled by reading the registry keys for SMSQLServer, or you could simply default them to :
C:\Program Files\Microsoft SQL Server\MSSQL\Data
and
C:\Program Files\Microsoft SQL Server\MSSQL\LogsHope this helps,
ChiThey mostly come at night...mostly.

![]() |
developer 2000 report
|
Batch File to Make anothe...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |