create table when user creates account?
create table when user creates account?
create table when user creates account?
create table when user creates account?
create table when user creates account?
create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account?
create table when user creates account? create table when user creates account?
create table when user creates account?
Go Back  Xtreme Visual Basic Talk > > > create table when user creates account?


Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2012, 05:51 PM
team biohazard team biohazard is offline
Newcomer
 
Join Date: Jul 2010
Posts: 4
Default create table when user creates account?


hello all,

how can I add a user to a table in a mysql database without datagridview ?

I already have this:

Code:
Dim conn As MySqlConnection
        'connect to DB
        conn = New MySqlConnection()
        conn.ConnectionString = "server=localhost; user id=root; password=test; database=test_addtable"
        'see if connection failed.
        Try
            conn.Open()
        Catch myerror As MySqlException
            MsgBox("Error connecting to database!")
        End Try
        'sql query
        Dim myAdapter As New MySqlDataAdapter

        Dim sqlquery = "SELECT * FROM user WHERE username = '" + registerform.usernametextbox.Text + "'"

        Dim myCommand As New MySqlCommand()
        myCommand.Connection = conn
        myCommand.CommandText = sqlquery
        'start query
        myAdapter.SelectCommand = myCommand
        Dim myData As MySqlDataReader
        myData = myCommand.ExecuteReader()
        'see if user exists
        If myData.HasRows = 0 Then

            conn.Close()
            conn.Open()
            Dim registerfinal As New MySqlDataAdapter

            sqlquery = "INSERT INTO user (Username, Password, Email) VALUES ('" + registerform.usernametextbox.Text + "','" + registerform.passwordtextbox.Text + "','" + registerform.emailtextbox.Text + "')"
            myCommand.Connection = conn
            myCommand.CommandText = sqlquery
            'start query
            registerfinal.SelectCommand = myCommand
            myData = myCommand.ExecuteReader()
            MsgBox("New user has been added to the database!")
            'add close
        Else
            'already exists
        End If
where to add the create table??

I need a table which contains the folllowing data:

Code:
CREATE TABLE  `test_addtable`.`username**` (              **must be username
`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`Name` VARCHAR( 45 ) NOT NULL ,
`Downloadlink` VARCHAR( 45 ) NOT NULL ,
`Description` TEXT NOT NULL
) ENGINE = INNODB;
[/LIST]
how to solve this ??
Thanks in common!

Cheers!
Reply With Quote
  #2  
Old 02-23-2012, 07:56 PM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

The first thing I see is that INSERT is not a query, a query (reading from the database) requires executereader. An insert would require an ExecuteNonQuery. The method for the insert can also be used with the Create Table statement. Just set that Create Table statement into a .CommandText method and use the same ExecuteNonQuery method to execute the statement.
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
  #3  
Old 02-23-2012, 09:54 PM
team biohazard team biohazard is offline
Newcomer
 
Join Date: Jul 2010
Posts: 4
Default

I solved it a time ago, thanks for helping anyway
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
create table when user creates account?
create table when user creates account?
create table when user creates account? create table when user creates account?
create table when user creates account?
create table when user creates account?
create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account? create table when user creates account?
create table when user creates account?
create table when user creates account?
 
create table when user creates account?
create table when user creates account?
 
-->