Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
for example :
while creating a table in mysql workbench, we enter values in textboxes and table is created. I am doing the same in my website but i don't know how to do it. please help. Thanks in advance!
Posted
Comments
ZurdoDev 17-May-13 8:24am    
Execute a CREATE TABLE statement in SQL. You'll have to dynamically build the SQL.
Member 10002696 17-May-13 8:35am    
@ryanb31 - I tried that but i need to use the user entered datatypes such as int varchar, is there any way to use the user entered datatypes into the table? That is the only problem i have.
Also i have to take care of foriegn keys.
Sudhakar Shinde 17-May-13 9:50am    
You can provide a dropdown list for the datatypes supported by MySQL.You need to make provision to accept datatype, Nullable, primary key, foreign key etc and dynamically build the SQL based on the inputs. You also need to validate the input as supported by MySQL. i.e. max characters for column name etc. Happy Coding.
Member 10002696 17-May-13 13:21pm    
@sudhakar- Yes i am using a drop down list for the datatypes but after retrieving the values from dropdownlist and textboxes, how do i create the table? shall i use a stored procedure? but if i do so, int datatypes will become varchar types. The code has to do something like this-
If user specifies a column of int type, this int type i have to use in create table statement. How can that be done?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900