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 22: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 Maciej Los 310
1 OriginalGriff 285
2 Afzaal Ahmad Zeeshan 200
3 Sergey Alexandrovich Kryukov 195
4 BillWoodruff 180
0 OriginalGriff 6,499
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,193
3 Manas Bhardwaj 4,657
4 Maciej Los 4,120


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.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