Click here to Skip to main content
15,889,281 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Check duplicate before inserting in database Pin
Viral Upadhyay19-Feb-10 0:22
Viral Upadhyay19-Feb-10 0:22 
AnswerRe: Check duplicate before inserting in database Pin
Anurag Gandhi18-Feb-10 23:31
professionalAnurag Gandhi18-Feb-10 23:31 
Questionhow to pass parameter from the main report to subreport based on the primary using report viewer + asp.net with C# Pin
Victoriya Raj18-Feb-10 18:32
Victoriya Raj18-Feb-10 18:32 
Questioncrystal report Pin
shanthi jothi18-Feb-10 18:20
shanthi jothi18-Feb-10 18:20 
AnswerRe: crystal report Pin
Arnalyn19-Feb-10 0:31
Arnalyn19-Feb-10 0:31 
QuestionDataSourceSelectArguments Cannot Be Converted to Integer Pin
Sid Childers18-Feb-10 18:18
Sid Childers18-Feb-10 18:18 
QuestionRetrieving checkbox value from db Pin
test-0918-Feb-10 17:55
test-0918-Feb-10 17:55 
AnswerRe: Retrieving checkbox value from db Pin
Dinesh Mani18-Feb-10 18:20
Dinesh Mani18-Feb-10 18:20 
Bigger picture here would help. What exactly do you want to do?

Do you wish to save the text for all the check boxes that have been checked? If yes then your code here is not doing it right.

Your code is static in nature
SqlCmd.CommandText = "insert into test(test1) values('"+ck.Text+"')";
SqlCmd.ExecuteNonQuery();
i.e. every time you get a positive, the query take the text value of the check box and saves it in the db against the same table column. So, what happens is the first positives text get over written by next which again get over written by the next and goes on until the last positive which gets saved ultimately.

If you wish to save all the texts to the db, then you have got to concatenate all the text values in one string, inside the foreach loop and use it in the query and execute it outside the loop.

HTH!
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 18:33
test-0918-Feb-10 18:33 
GeneralRe: Retrieving checkbox value from db Pin
Dinesh Mani18-Feb-10 18:36
Dinesh Mani18-Feb-10 18:36 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 18:41
test-0918-Feb-10 18:41 
GeneralRe: Retrieving checkbox value from db Pin
Dinesh Mani18-Feb-10 19:13
Dinesh Mani18-Feb-10 19:13 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 19:24
test-0918-Feb-10 19:24 
GeneralRe: Retrieving checkbox value from db Pin
Dinesh Mani18-Feb-10 19:29
Dinesh Mani18-Feb-10 19:29 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 19:35
test-0918-Feb-10 19:35 
GeneralRe: Retrieving checkbox value from db Pin
Dinesh Mani18-Feb-10 19:43
Dinesh Mani18-Feb-10 19:43 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 19:55
test-0918-Feb-10 19:55 
GeneralRe: Retrieving checkbox value from db Pin
Dinesh Mani18-Feb-10 20:08
Dinesh Mani18-Feb-10 20:08 
GeneralRe: Retrieving checkbox value from db Pin
Ravindra Nidhonkar18-Feb-10 22:32
Ravindra Nidhonkar18-Feb-10 22:32 
AnswerRe: Retrieving checkbox value from db Pin
Anurag Gandhi18-Feb-10 18:38
professionalAnurag Gandhi18-Feb-10 18:38 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 18:46
test-0918-Feb-10 18:46 
AnswerRe: Retrieving checkbox value from db Pin
Brij18-Feb-10 18:48
mentorBrij18-Feb-10 18:48 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 18:56
test-0918-Feb-10 18:56 
GeneralRe: Retrieving checkbox value from db Pin
Brij18-Feb-10 19:10
mentorBrij18-Feb-10 19:10 
GeneralRe: Retrieving checkbox value from db Pin
test-0918-Feb-10 23:34
test-0918-Feb-10 23:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.