I would like to know how to a use a text box in winform to name the table .
can anybody help me please

I am using the following statement to create table

SQL = "CREATE TABLE tbCatalogue ([Id] COUNTER, [Stock Code] TEXT(10), [Account Number] TEXT(6))"

Recommended Answers

you need to capture value from any control using variable and later use the same in your SQL statemnet.

Jump to Post

All 4 Replies

you need to capture value from any control using variable and later use the same in your SQL statemnet.

As i presumes you want to create table using any of the field like textbox or combobox....
Just understand this code that how it works and your problem will be solved-

<form method="POST">
Enter table name<input type="text" name="t_name">
<input type="submit" value="submit" name="submit">
</form>
<?php
if(isset($_POST['t_name']))
{
//database connection string
SQL = "CREATE TABLE ".$_POST['t_name']."([Id] COUNTER, [Stock Code] TEXT(10), [Account Number] TEXT(6))"
}
?>

Hopefully it is clear...If you have any doubt you can post it ...
PS-IF your problem is solved mark the thread as solved...

Just understand this code that how it works and your problem will be solved-

Of course you will have to check first if the table already exists, maybe include a DROP TABLE statement, sanitize the input so that no malicious user can compromise or erase your whole database, and set the character sets and collating sequences according to your needs.

Thanks all of you ,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.