Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
i have to list one is ques id and second is option txt and two button i want that when i chose one ques and option and click on button the it will insert in the dataset temporary and when i fill all quset and option then it wil store in databse on scnd butto click.
my code is
Public Sub setques()
       cm = New SqlCommand("select * from ques_mst where ques_id='" & rbl_ques.Text & "'  ", con)
       da = New SqlDataAdapter(cm)
       ds = New DataSet
       da.Fill(ds, "q2")
 
       If ds.Tables("q2").Rows.Count > 0 Then
 
           If q <= ds.Tables("q2").Rows.Count Then
               Me.tb_qid.Text = ds.Tables("q2").Rows(q).Item("ques_id").ToString
               Me.tb_ques.Text = ds.Tables("q2").Rows(q).Item("ques_txt").ToString
               q = q + 1
           End If
 
           cm = New SqlCommand("select * from option_mst where  ques_id  = '" & rbl_ques.SelectedValue & "'", con)
           da = New SqlDataAdapter(cm)
           ds = New DataSet
           da.Fill(ds, "o1")
           rbl_option.Items.Clear()
           If ds.Tables("o1").Rows.Count > 0 Then
               i = ds.Tables("o1").Rows.Count
               c = 0
 
               While c < i
 
                   Me.rbl_option.Items.Add(ds.Tables("o1").Rows(c).Item("option_txt").ToString)
                   c = c + 1
               End While
           End If
 

       End If
       c = 0
       i = 0
   End Sub
   Public Sub getqid()
       cm = New SqlCommand("select * from ques_mst ", con)
       da = New SqlDataAdapter(cm)
       ds = New DataSet
       da.Fill(ds, "q2")
       rbl_option.Items.Clear()
       If ds.Tables("q2").Rows.Count > 0 Then
           i = ds.Tables("q2").Rows.Count
           c = 0
 
           While c < i
 
               Me.rbl_ques.Items.Add(ds.Tables("q2").Rows(c).Item("ques_id").ToString)
               c = c + 1
           End While
       End If
       i = 0
       c = 0
   End Sub
 

   Protected Sub rbl_ques_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbl_ques.SelectedIndexChanged
       setques()
 
   End Sub
 

   Protected Sub b_submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b_submit.Click
 
       cm = New SqlCommand("select * from feedback_detail_mst where ques_id='" & rbl_ques.SelectedValue & "'", con)
       da = New SqlDataAdapter(cm)
       ds = New DataSet
       da.Fill(ds, "fd")
       If ds.Tables("fd").Rows.Count > 0 Then
           MsgBox("Question already attemped", MsgBoxStyle.Critical, "FACULTY APPRAISAL")
       Else
           ds.Tables("fd").Columns.Add("qid")
           ds.Tables("fd").Columns.Add("option_txt")
 

           dr(1) = ds.Tables.Add.Rows(1).Item("ques_id").ToString
           'dr(1) = rbl_option.SelectedItem.Text

           MsgBox(dt)
       End If
   End Sub
 
   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
 
   End Sub
Posted 7-Feb-13 21:39pm
Comments
Muthuraja Irullandi at 8-Feb-13 6:46am
   
Hi,
Could you please explain the actual issue with your code?
supriya931 at 13-Feb-13 23:18pm
   
actually i want to save all ques in one place and when i click on button then all the question inserted in to database at same time from that place on one click only

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 310
1 Sergey Alexandrovich Kryukov 192
2 PhilLenoir 164
3 Richard MacCutchan 160
4 Sharmanuj 146
0 Sergey Alexandrovich Kryukov 6,077
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web04 | 2.8.140814.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100