Pls help me with this procedure...

yasinirshad

New member
Joined
Aug 5, 2007
Messages
3
Programming Experience
Beginner
Hi, Please help me with writng procedure. Please see the code below and help me with the procedure syntax.

VB.NET:
Public Sub insertmail(ByVal strFromId As String, ByVal strScope As String, ByVal strToId As String, ByVal strCallId As String, ByVal strRemarks As String)

strFromId = (procedure to get email from id) For this query is "SELECT USER_ID,USER_EMAIL FROM USERS WHERE USER_ID='""'"

strToId = (procedure to get email id to send) For this query is "SELECT USERS.USER_ID,SCOPE.TYPE_LABEL,SCOPE.SCOPE_LABEL,USERS.USER_EMAIL FROM SCOPE INNER JOIN USERS ON SCOPE.SCOPE_ADMIN = USERS.USER_ID"

strmsgSubject = "iCalls: & strScope & strFromId & strCallId"

            strMsgBody = "strmsgSubject & strRemarks"

            strSQL = "Insert into EPS_CT_EMAIL(strFromId,strScope,strToId,strCallId,strRemarks) values ('" & strFromId & "','" & strScope & "','" & strToId & "','" & strCallId & "','" & strRemarks & "' )"
Can u please help me with the syntax for above code.. I am passing the parameters as string and inserting them into tables.. Thanks in advance.
 
take a read of the PQ link i have in my signature.. then also take a read of the DW1 link in my signature.. one of the walkthrough sections will be relevant to saving data to a database
 
Help me with change password - code attached.

Hi, Please see my below code to change password. Here i need to check for old password from database and need to update new password. But when i try to submit by giving wrong old password ,its redirecting me to PasswordSet.aspx whereas it shd give message Invalid Old Password. It shd redirect me only when user gives correct old password and enters new password. please help.
VB.NET:
Private Sub btn_submit_ServerClick(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btn_submit.ServerClick

        Dim myConnection, myCommand
        Dim intUserCount As Integer
        Dim strSQL As String

        strSQL = "UPDATE EPSusers SET Password='" & Replace(txt_newpassword.Text, "'", "''") & "' " & "WHERE UserName='" & Replace(txt_uid.Text, "'", "''") & "' " _
         & "AND Password='" & Replace(txt_oldpassword.Text, "'", "''") & "';"

        myConnection = New SqlConnection("Server=(local);Database=testdb;uid=sa;password=courage")

        myCommand = New SqlCommand(strSQL, myConnection)

        myConnection.Open()
        intUserCount = myCommand.ExecuteScalar()
        myConnection.Close()

        If txt_oldpassword.Text.Trim = "" Then
            lblStatus.Text = "Invalid Old Password!"
            'Exit Sub
            FormsAuthentication.SetAuthCookie(txt_oldpassword.Text, True)
            lblInvalid.Text = "Your User Name and Password cannot be located, try again.!!!."
            'Session("UName") = txt_uid.Text
            'Response.Redirect("PasswordSet.aspx")
        Else
            'lblInvalid.Text = "Your User Name and Password cannot be located, try again.!!!."
            Response.Redirect("PasswordSet.aspx")
        End If
    End Sub
 
Back
Top