user682417
user682417

Reputation: 1518

trying to insert values into table

I am trying to inserting value enter in textbox into table like this

"INSERT INTO guestpasstypes(guestPassType_Name) VALUES('"+tbPassType.Text"'"); 

it was giving error like ";" missed

Upvotes: 0

Views: 159

Answers (4)

Ash Burlaczenko
Ash Burlaczenko

Reputation: 25465

If your going to carry on with this type of programming use

"Insert INTO guestpasstypes(guestPassType_Name)values('"+tbPassType.Text"')";

Otherwise, you should definitely look into sanitizing your sql.

Upvotes: 0

Pankaj Agarwal
Pankaj Agarwal

Reputation: 11309

"Insert into guestpasstypes (guestPassType_Name) values ('" + tbPassType.Text + "')"

Upvotes: 2

Balanivash
Balanivash

Reputation: 6867

INSERT INTO  guestpasstypes(guestPassType_Name) VALUES ('"+tbPassType.Text+"')"

The second quote should be outside the parantheses

Upvotes: 0

Gabriel Spiteri
Gabriel Spiteri

Reputation: 4978

You are missing a concatenation operator:

"Insert INTO guestpasstypes(guestPassType_Name)values('" + tbPassType.Text + "');"; 

Upvotes: 1

Related Questions