Computing.Net > Forums > Programming > Create Table SQL command with VB6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Create Table SQL command with VB6

Reply to Message Icon

Name: rajumak
Date: January 31, 2007 at 10:40:33 Pacific
OS: Win ME
CPU/Ram: P4/512MB
Product: Intel
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: February 2, 2007 at 08:26:22 Pacific
Reply:

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
txtDatabaseName

the 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\Logs

Hope this helps,
Chi

They mostly come at night...mostly.


0
Reply to Message Icon

Related Posts

See More


developer 2000 report Batch File to Make anothe...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Create Table SQL command with VB6

Problem with an .EXE made with VB6 www.computing.net/answers/programming/problem-with-an-exe-made-with-vb6/7669.html

MySQL commands with batch files www.computing.net/answers/programming/mysql-commands-with-batch-files/19666.html

HOW CAN I RUN UNIX COMMANDS in VB6? www.computing.net/answers/programming/how-can-i-run-unix-commands-in-vb6/14264.html