Click here to Skip to main content
15,037,009 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i insert data in sql server 2005 through c# i have two table one table name is "category_type""primary table" the second table name is "sub category""foreign table"
the category_type attributes are (PK)type_id,category_name......... the sub category attributes are (PK)sub_id,(FK)type_id,item_name..... i want to hide type_id in the front end user do not entered type_id in front end "how"

1 solution

for the type_id column, set its "Identity Specification" to true in sql server. Take values for other columns except type_id from your user.

try the following sql string-
"insert into category_type(category_name) values('your category name')"

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