tehon3299 Posted February 7, 2003 Posted February 7, 2003 Hey - How would I create an SQL table on an ASPX page? If I use:Create Table tbMisc then it say Create is not defined? What's the problem? I have Import Namespace="System.Data.Sqlclient". Any ideas? Thanks Quote Thanks, Tehon
Moderators Robby Posted February 7, 2003 Moderators Posted February 7, 2003 try this... Dim con As New SqlConnection("server=127.0.0.1;Trusted_Connection=yes;database=Northwind") con.Open() Dim cmd As New SqlCommand("CREATE TABLE Test (Col1 Text, col2 Text)", con) cmd.ExecuteNonQuery() con.Close() Quote Visit...Bassic Software
tehon3299 Posted February 8, 2003 Author Posted February 8, 2003 That works perfect. Now how could I use a variable for the table name?? Thanks Quote Thanks, Tehon
Moderators Robby Posted February 8, 2003 Moderators Posted February 8, 2003 Dim cmd As New SqlCommand("CREATE TABLE " & TextBox1.Text.ToString & " (Col1 Text, col2 Text)", con) Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.