.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

ถามเรื่องเกี่ยวกับ CheckBoxList ค่ะ Options · View
lllwilll
Posted: Saturday, March 15, 2008 3:53:00 PM
Rank: มือสมัครเล่น
Groups: Member

Joined: 1/10/2008
Posts: 14

ใช้ CheckBoxList

มีค่าที่เก็บในตารางดังนี้ 1. การเงิน

                                      2. ที่พัก

                                      3. อุปกรณ์การศึกษา

                                      4. เครื่องแต่งกาย

เราเลือกติ๊กข้อ 2 กับ 3 แต่ค่าที่เก็บลง database จะลงแค่ค่าแรกค่ะ ทำยังไงให้เก็บที่ถูกเลือกทั้งข้อ 2 และ 3 ได้ค่ะ ดังรูป(ใช้ SqlDatasource)

 โค้ตที่ Insert ลง Database

string connString = @"Data Source=.\SQLEXPRESS;Initial Catalog=ScholarShipDb;Integrated Security=True"; SqlConnection ScholarShipConnection = new SqlConnection(connString); ScholarShipConnection.ConnectionString = connString; ScholarShipConnection.Open(); StringBuilder stb = new StringBuilder(); stb.Append("Insert into studentApply (Stu_ID,FirstName,LastName,ID_Card,Birthday,Age,Faculty,Major,Class,GPA,Address1,Soi,Road,Tumbon,Ampur,City,PostCode,Name_Father,Name_Mother,Income_Father,Income_Mother,Extraction,Nationality,Age_Father,Parentalive_Father,Occupation_Father,WorkPlace_Father,Tel_Father,Age_Mother,Parentalive_Mother,Occupation_Mother,WorkPlace_Mother,Tel_Mother,Area_Agriculture,Number_Area,Income_Year,Relation_Family,Relatives,Study,Earn,Family,Sex1,Name1,Level1,Occupation1,WorkPlace1,Income1,Sex2,Name2,Level2,Occupation2,WorkPlace2,Income2,Sex3,Name3,Level3,Occupation3,WorkPlace3,Income3,Sex4,Name4,Level4,Occupation4,WorkPlace4,Income4,Sex5,Name5,Level5,Occupation5,WorkPlace5,Income5,Expenses,Sponser_Name,About_Stu,Occupation_Sponser,Income_Sponser,Accessories_Support,Name_Scho1,Name_Scho2,Name_Scho3,Name_Scho4,Name_Scho5,Year1,Year2,Year3,Year4,Year5,Scho_Bath1,Scho_Bath2,Scho_Bath3,Scho_Bath4,Scho_Bath5,Activity,Activity1,Job,Job1,Doc_Composition,Image_Doc) values (@Stu_ID,@FirstName,@LastName,@ID_Card,@Birthday,@Age,@Faculty,@Major,@Class,@GPA,@Address1,@Soi,@Road,@Tumbon,@Ampur,@City,@PostCode,@Name_Father,@Name_Mother,@Income_Father,@Income_Mother,@Extraction,@Nationality,@Age_Father,@Parentalive_Father,@Occupation_Father,@WorkPlace_Father,@Tel_Father,@Age_Mother,@Parentalive_Mother,@Occupation_Mother,@WorkPlace_Mother,@Tel_Mother,@Area_Agriculture,@Number_Area,@Income_Year,@Relation_Family,@Relatives,@Study,@Earn,@Family,@Sex1,@Name1,@Level1,@Occupation1,@WorkPlace1,@Income1,@Sex2,@Name2,@Level2,@Occupation2,@WorkPlace2,@Income2,@Sex3,@Name3,@Level3,@Occupation3,@WorkPlace3,@Income3,@Sex4,@Name4,@Level4,@Occupation4,@WorkPlace4,@Income4,@Sex5,@Name5,@Level5,@Occupation5,@WorkPlace5,@Income5,@Expenses,@Sponser_Name,@About_Stu,@Occupation_Sponser,@Income_Sponser,@Accessories_Support,@Name_Scho1,@Name_Scho2,@Name_Scho3,@Name_Scho4,@Name_Scho5,@Year1,@Year2,@Year3,@Year4,@Year5,@Scho_Bath1,@Scho_Bath2,@Scho_Bath3,@Scho_Bath4,@Scho_Bath5,@Activity,@Activity1,@Job,@Job1,@Doc_Composition,@Image_Doc) ");

SqlCommand cmd = ScholarShipConnection.CreateCommand();

cmd.Parameters.Add("@Accessories_Support", SqlDbType.NVarChar).Value = Accessories_Support.Text;

 

รบกวนทีค่ะ ขอบคุณค่ะ

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by