Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to assign role to linq queries? Pin
miss78617-Mar-14 1:36
miss78617-Mar-14 1:36 
AnswerRe: How to assign role to linq queries? Pin
kaushikpathak18-Mar-14 1:26
kaushikpathak18-Mar-14 1:26 
GeneralRe: How to assign role to linq queries? Pin
miss78618-Mar-14 1:51
miss78618-Mar-14 1:51 
GeneralRe: How to assign role to linq queries? Pin
kaushikpathak18-Mar-14 2:36
kaushikpathak18-Mar-14 2:36 
GeneralRe: How to assign role to linq queries? Pin
miss78618-Mar-14 2:48
miss78618-Mar-14 2:48 
Questionhow to set the visibility true for <Div> tag in vb.net Pin
Nandan Basak16-Mar-14 21:46
Nandan Basak16-Mar-14 21:46 
Questionyoutube videos behind login page Pin
raghushetty1616-Mar-14 21:41
raghushetty1616-Mar-14 21:41 
Questiondata is not getting saved to the database. Pin
samflex15-Mar-14 13:18
samflex15-Mar-14 13:18 
Hello Experts,

This is my very first post here. so, please take easy on me.

I wrote a stored proc that takes 4 parameters and inserts into the db.

I have tested it using SSMS and it works great but I can't get it work with my .net app.

No errors but just doesn't work.

This is supposed to go live on Tuesday and I must give a demo by Monday.

The insert bit is the last task and is supposed to be easy.

Can someone please help?

Code is below and thanks a lot in advance.

PHP
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)

    Dim questld As HiddenField = DataList1.FindControl("HiddenField2")

    For Each item As DataListItem In DataList1.Items
        If item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem Then
            Dim positionid As Integer
            Dim choiceid As Integer = 0
            Dim choicetext As String = ""
            'positionid = CType(item.FindControl("Label3"), Label).Text
            positionid = CType(item.FindControl("HiddenField2"), HiddenField).Value
            Dim anstype As HiddenField = item.FindControl("HiddenField1")
            Select Case anstype.Value
                Case "S"
                    Dim rbl As RadioButtonList = item.FindControl("RadioButtonList1")
                    choiceid = rbl.SelectedValue
                    SaveVotes(positionid, choiceid, choicetext, "")
                Case "M"
                    Dim cbl As CheckBoxList = item.FindControl("CheckBoxList1")
                    For i As Integer = 0 To cbl.Items.Count - 1
                        If cbl.Items(i).Selected Then
                            choiceid = cbl.Items(i).Value
                            SaveVotes(positionid, choiceid, "NA", "")
                        End If
                    Next
                Case "T"
                    Dim txt As TextBox = item.FindControl("TextBox1")
                    choicetext = txt.Text
                    SaveVotes(positionid, 0, choicetext, "")
            End Select
        End If
    Next
    DataList1.Visible = False

End Sub
Private Sub SaveVotes(ByVal qid As Integer, ByVal cid As Integer, ByVal ct As String, ByVal cuser As String)

    Dim al As ArrayList = CType(Session("AnswerList"), ArrayList)
    'Dim s As String


    If al Is Nothing Then
        Response.Redirect("Thanks.aspx")
    End If

    Dim connStr As String = ConfigurationManager.ConnectionStrings("BallotsConnectionString").ConnectionString
    Dim conn As New SqlConnection(connStr)
    Dim cmd As New SqlCommand("InsertBallots", conn)
    cmd.CommandType = CommandType.StoredProcedure
    Dim p1 As New SqlParameter("@qid", qid)
    Dim p2 As New SqlParameter("@cid", IIf(cid = 0, DBNull.Value, cid))
    Dim p3 As New SqlParameter("@ct", IIf(ct = "", DBNull.Value, ct))
    Dim p4 As New SqlParameter("@cuser", Session("UserName"))
    cmd.Parameters.Add(p1)
    cmd.Parameters.Add(p2)
    cmd.Parameters.Add(p3)
    cmd.Parameters.Add(p4)
    conn.Open()
    cmd.ExecuteNonQuery()
    conn.Close()

End Sub


modified 15-Mar-14 19:57pm.

AnswerRe: data is not getting saved to the database. Pin
Garth J Lancaster15-Mar-14 14:45
professionalGarth J Lancaster15-Mar-14 14:45 
GeneralRe: data is not getting saved to the database. Pin
samflex15-Mar-14 16:21
samflex15-Mar-14 16:21 
GeneralRe: data is not getting saved to the database. Pin
samflex16-Mar-14 9:55
samflex16-Mar-14 9:55 
QuestionLogin status Pin
sbangani15-Mar-14 5:26
sbangani15-Mar-14 5:26 
QuestionFacebook share using jQuery Pin
Member 803236015-Mar-14 2:45
Member 803236015-Mar-14 2:45 
AnswerRe: Facebook share using jQuery Pin
Tom Marvolo Riddle15-Mar-14 3:22
professionalTom Marvolo Riddle15-Mar-14 3:22 
QuestionFacebook share button is not working Pin
Member 803236014-Mar-14 21:47
Member 803236014-Mar-14 21:47 
GeneralRe: Facebook share button is not working Pin
Peter Leow14-Mar-14 22:01
professionalPeter Leow14-Mar-14 22:01 
Questioncant trigger button server side event Pin
vangli13-Mar-14 22:26
vangli13-Mar-14 22:26 
AnswerRe: cant trigger button server side event Pin
kaushikpathak18-Mar-14 1:41
kaushikpathak18-Mar-14 1:41 
QuestionPage Cache - Panel control Pin
oDoJo13-Mar-14 19:37
oDoJo13-Mar-14 19:37 
QuestionHow to playing song in the mobil devices with my ASP Pin
famontepeque13-Mar-14 10:20
famontepeque13-Mar-14 10:20 
AnswerRe: How to playing song in the mobil devices with my ASP Pin
Bernhard Hiller14-Mar-14 0:36
Bernhard Hiller14-Mar-14 0:36 
GeneralRe: How to playing song in the mobil devices with my ASP Pin
famontepeque15-Mar-14 3:49
famontepeque15-Mar-14 3:49 
GeneralRe: How to playing song in the mobil devices with my ASP Pin
Richard Deeming17-Mar-14 2:27
mveRichard Deeming17-Mar-14 2:27 
Questionasp.net dropdownlist show all list item Pin
VLRRAJ13-Mar-14 4:18
VLRRAJ13-Mar-14 4:18 
AnswerRe: asp.net dropdownlist show all list item Pin
_AK_13-Mar-14 4:34
_AK_13-Mar-14 4: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.