System.Outof MemoryException when filling DataAdapter in ASP.Net

Last Reply 2 months ago By dharmendr

Posted 2 months ago

Getting exception while executive vb.net code ...........

 

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

Results 1 - 5 of 8 12
Posted 2 months ago

Hi manoj07,

Please share your code and html. Also let me know which line you are getting the error.


Posted 2 months ago

 

Imports System.Web.Services
Imports System.Data.SqlClient
Imports System.Drawing
Imports MySql.Data.MySqlClient
Public Class hrreports
    Inherits System.Web.UI.Page
    Dim pnsconn As SqlConnection
    Dim pnscomm As SqlCommand
    Dim pnsreader, pnsreader1 As SqlDataReader
    Dim strsql, topic_name As String
    Private lblMsg As Object
    Private ddl1select1 As String
    Dim ddl1select2 As String
    Dim ddl1select3 As String
    Dim ddl1select4 As String
    Dim subjectx As String
    Dim prime_resp_no As String
    Dim objreader As SqlDataReader
    Dim objreader1 As SqlDataReader
    Dim conn1 As New MySqlConnection



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'BindData()
        ' conn.close
        If Session("validsession") <> "Valid" Then
            Response.Write("Invalid Session")
            Response.End()
        End If
        If Not Page.IsPostBack Then
            'Bindlast()

            BindData()
            send_message()

        End If
        'Bindlast()
        ' Page.Header.DataBind()
    End Sub
    <WebMethod()>
    Public Shared Function GetCustomers1(prefix As String) As String()
        Dim customers As New List(Of String)()
        Dim strConnString As String
        strConnString = ConfigurationManager.ConnectionStrings("cmdpns").ToString
        ' Using conn As New SqlConnection("Data Source=localhost\SQLEXPRESS;Initial Catalog=cmdpns;Persist Security Info=True;User ID=sa;Password=iwpatch9%$#LM;MultipleActiveResultSets=true")
        Using conn As New SqlConnection(strConnString)
            'Using conn As New SqlConnection("Data Source=localhost\SQLEXPRESS;Initial Catalog=cmdpns;Persist Security Info=True;User ID=sa;Password=iwpatch9%$#LM;MultipleActiveResultSets=true")
            'conn.ConnectionString = "Data Source=(local)\SQLEXPRESS;Initial Catalog=cmdpns;User ID=cmdpns;Password=cmdpns123 providerName=System.Data.SqlClient"
            Using cmd As New SqlCommand()
                cmd.CommandText = "Select prime_resp_name,prime_resp_desig,project from prime_resp_master where prime_resp_name Like @SearchText + '%'"
                cmd.Parameters.AddWithValue("@SearchText", prefix)
                cmd.Connection = conn
                conn.Open()
                Using sdr As SqlDataReader = cmd.ExecuteReader()
                    While sdr.Read()
                        customers.Add(String.Format("{0},{1},{2}", sdr("prime_resp_name"), sdr("prime_resp_desig"), sdr("project")))
                    End While
                End Using
                conn.Close()
            End Using
        End Using
        Return customers.ToArray()
    End Function

    Protected Sub Pop_No(prime_no)
        Dim prime_resp_no As String = prime_no.Text
        Dim strConnString As String
        strConnString = ConfigurationManager.ConnectionStrings("cmdpns").ToString
        ' Using conn As New SqlConnection("Data Source=localhost\SQLEXPRESS;Initial Catalog=cmdpns;Persist Security Info=True;User ID=sa;Password=iwpatch9%$#LM;MultipleActiveResultSets=true")
        Using conn As New SqlConnection(strConnString)
            'Using con As New SqlConnection("Data Source=localhost\SQLEXPRESS;Initial Catalog=cmdpns;Persist Security Info=True;User ID=sa;Password=iwpatch9%$#LM;MultipleActiveResultSets=true")
            conn.Open()
            Dim cmd = New SqlCommand("insert into record_table (prime_resp_no) values (@prime_resp_no)", conn)
            'Dim cmd = New SqlCommand("insert into record_table (project) values (@project)", con)
            cmd.Parameters.AddWithValue("@prime_resp_no", prime_resp_no)
            'cmd.ExecuteNonQuery()
            'Dim cmd As New SqlCommand("select userid,login_token from dms_user where userid = '" + Login2 + "'", con)
            conn.Close()
        End Using
    End Sub



    Protected Sub OnPageIndexChanging(sender As Object, e As GridViewPageEventArgs)
        GridView1.PageIndex = e.NewPageIndex
        'Me.BindData()
        Me.Bindlast()
    End Sub

    Public Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        'BindGrid()
        ddl1select1 = DropDownList1.SelectedItem.Value
        ' ddl1select = "KORBA"
        'Fillddl2(ddl1select1)

        'DropDownList2.Items.Insert(0, New ListItem("--Select Subject--", "0"))
        'con.Close()
        'GridView1.Rows.Clear()
        Dim constr1 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
        Dim sqlstring = "select * from insu_dtl where project=@project order by id desc"
        Session("laststring") = sqlstring
        Using conn As New SqlConnection(constr1)
            Using cmd1 As New SqlCommand("select * from insu_dtl where project=@project order by id desc")

                cmd1.Parameters.AddWithValue("@project", ddl1select1)
                cmd1.CommandType = CommandType.Text
                cmd1.Connection = conn
                Using sda1 As New SqlDataAdapter(cmd1)
                    Dim ds1 As New DataSet()
                    sda1.Fill(ds1)
                    GridView1.DataSource = Nothing
                    GridView1.DataSource = ds1.Tables(0)
                    GridView1.DataBind()
                    Dim dt As New DataTable()
                    dt = ds1.Tables(0)
                    Session("Test") = dt


                End Using
            End Using
        End Using


    End Sub

    Public Property SortExpression As String
        Get
            If ViewState("SortExpression") Is Nothing Then
                ViewState("SortExpression") = "id DESC"
            End If
            Return ViewState("SortExpression").ToString
        End Get
        Set(value As String)
            ViewState("SortExpression") = value
        End Set
    End Property
    Protected Sub GridView1_Sorting(sender As Object, e As GridViewSortEventArgs)
        Dim currentSortColumn, currentSortDirection As String
        currentSortColumn = Me.SortExpression.Split(" "c)(0)
        currentSortDirection = Me.SortExpression.Split(" "c)(1)
        If e.SortExpression.Equals(currentSortColumn) Then
            ' switch sort direction '
            Select Case currentSortDirection.ToUpper
                Case "ASC"
                    Me.SortExpression = currentSortColumn & " DESC"
                Case "DESC"
                    Me.SortExpression = currentSortColumn & " ASC"
            End Select
        Else
            Me.SortExpression = e.SortExpression & " ASC"
        End If
        BindData()
    End Sub
    Private Function BindData() As DataTable
        Dim constr2 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
        Using conn As New SqlConnection(constr2)
            ' Using cmd2 As New SqlCommand("select * from record_table where user_id=@user_id order by id desc")
            'Using cmd2 As New SqlCommand("select * from record_table where user_id=@user_id order by ORDER BY {0}")
            Dim Sql As String = "select * from insu_dtl where dl_name Is Not NULL order by {0}"
            Dim sqlstring = "select * from insu_dtl where dl_name Is Not NULL order by {0}"
            Session("laststring") = sqlstring
            Dim cmd2 = New SqlClient.SqlCommand()
            cmd2.Parameters.AddWithValue("@user_id", Session("user_id"))
            cmd2.CommandText = String.Format(Sql, Me.SortExpression)
            'cmd2.Parameters.AddWithValue("@sort", 1)
            'cmd2.CommandType = CommandType.Text
            cmd2.Connection = conn
            Using sda2 As New SqlDataAdapter(cmd2)
                Dim ds2 As New DataTable()
                sda2.Fill(ds2)
                'GridView1.DataSource = Nothing
                GridView1.DataSource = ds2
                GridView1.DataBind()
                Session("Test") = ds2
                Return ds2

            End Using
        End Using

    End Function
    Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs)

    End Sub

    Private Sub BindGrid()
        Dim dt1 As DataTable
        dt1 = DirectCast(Session("Test"), DataTable)
        GridView1.DataSource = dt1
        GridView1.DataBind()
    End Sub
    Private Sub Bindlast()
        ddl1select1 = DropDownList1.SelectedItem.Value

        Dim name1 As String = (TextBox8.Text).ToString
        Dim name2 As String() = name1.Split(New Char() {","c})
        Dim name As String = name2(0).ToString
        Session("name1") = name
        Session("due_date1") = TextBox6.Text
        Session("start_date") = TextBox9.Text
        Session("end_date") = TextBox10.Text
        Dim constr2 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
        Using conn As New SqlConnection(constr2)

            Dim Sql As String = Session("laststring")
            Dim cmd2 = New SqlClient.SqlCommand()
            cmd2.Parameters.AddWithValue("@user_id", Session("user_id"))
            cmd2.Parameters.AddWithValue("@project", ddl1select1)
            cmd2.CommandText = String.Format(Sql, Me.SortExpression)

            cmd2.Parameters.AddWithValue("@user_text", Session("name1"))

            cmd2.Parameters.AddWithValue("@due_date", Session("due_date1"))
            cmd2.Parameters.AddWithValue("@end_date", Session("end_date"))
            cmd2.Parameters.AddWithValue("@start_date", Session("start_date"))

            cmd2.Connection = conn
            Using sda2 As New SqlDataAdapter(cmd2)
                Dim ds2 As New DataTable()
                sda2.Fill(ds2)
                'GridView1.DataSource = Nothing
                GridView1.DataSource = ds2
                GridView1.DataBind()


            End Using
        End Using

    End Sub

    Protected Sub TextBox6_TextChanged(sender As Object, e As EventArgs) Handles TextBox6.TextChanged
        Dim sdd1, smm1, syy1, sdt1 As String
        If TextBox6.Text <> Nothing And TextBox6.Text <> "&nbsp;" Then

            sdt1 = TextBox6.Text

            smm1 = Left(sdt1, 2)
            sdd1 = Mid(sdt1, 4, 2)
            syy1 = Mid(sdt1, 7, 4)

            Session("due_date1") = sdt1
            ' sdt1 = smm1 + "/" + sdd1 + "/" + syy1
            sdt1 = syy1 + "-" + smm1 + "-" + sdd1

            Dim constr5 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Using conn As New SqlConnection(constr5)
                Dim sqlstring = "Select * from insu_dtl WHERE ins_valid=@due_date order by id desc"
                Session("laststring") = sqlstring
                Using cmd7 As New SqlCommand("Select * from insu_dtl WHERE ins_valid=@due_date order by id desc")
                    cmd7.Parameters.AddWithValue("@due_date", sdt1)
                    'cmd2.Parameters.AddWithValue("@project", ddl1select)
                    cmd7.CommandType = CommandType.Text
                    cmd7.Connection = conn
                    Using sda2 As New SqlDataAdapter(cmd7)
                        Dim ds2 As New DataSet()
                        sda2.Fill(ds2)
                        'GridView1.DataSource = Nothing
                        GridView1.DataSource = ds2.Tables(0)
                        GridView1.DataBind()
                        Dim dt As New DataTable()
                        dt = ds2.Tables(0)
                        Session("Test") = dt
                        ' DropDownList2.DataTextField = "topic"
                        'DropDownList2.DataValueField = "topic"
                        'GridView1.DataBind()
                    End Using
                End Using
            End Using
            'pnscomm.Parameters.AddWithValue("@due_date", CDate(txtSelectedDate.Text))


        End If
    End Sub
    Protected Sub TextBox10_TextChanged(sender As Object, e As EventArgs) Handles TextBox10.TextChanged
        Dim sdd1, smm1, syy1, sdt1, sdt2 As String
        If TextBox10.Text <> Nothing And TextBox10.Text <> "&nbsp;" Then

            sdt2 = TextBox10.Text
            sdt1 = TextBox9.Text

            Session("start_date") = sdt1
            Session("end_date") = sdt2

            Dim constr5 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Using conn As New SqlConnection(constr5)
                Dim sqlstring = "Select * from insu_dtl WHERE (regno Is Not NULL) And (dl_valid Between @start_date And @end_date) order by id desc"
                Session("laststring") = sqlstring
                Using cmd7 As New SqlCommand("Select * from insu_dtl WHERE (regno Is Not NULL) And (dl_valid Between @start_date And @end_date) order by id desc")
                    cmd7.Parameters.AddWithValue("@end_date", sdt2)
                    cmd7.Parameters.AddWithValue("@start_date", sdt1)

                    'cmd2.Parameters.AddWithValue("@project", ddl1select)
                    cmd7.CommandType = CommandType.Text
                    cmd7.Connection = conn
                    Using sda2 As New SqlDataAdapter(cmd7)
                        Dim ds2 As New DataSet()
                        sda2.Fill(ds2)
                        'GridView1.DataSource = Nothing
                        GridView1.DataSource = ds2.Tables(0)
                        GridView1.DataBind()
                        Dim dt As New DataTable()
                        dt = ds2.Tables(0)
                        Session("Test") = dt
                        ' DropDownList2.DataTextField = "topic"
                        'DropDownList2.DataValueField = "topic"
                        'GridView1.DataBind()
                    End Using
                End Using
            End Using
            'pnscomm.Parameters.AddWithValue("@due_date", CDate(txtSelectedDate.Text))


        End If
    End Sub
    Protected Sub TextBox8_TextChanged(sender As Object, e As EventArgs) Handles TextBox8.TextChanged
        If TextBox8.Text <> Nothing And TextBox8.Text <> "&nbsp;" Then
            Dim name1 As String = (TextBox8.Text).ToString
            Dim name2 As String() = name1.Split(New Char() {","c})
            Dim name As String = name2(0).ToString
            Session("name1") = name
            ' Dim c_date As DateTime = DateTime.Now.AddDays(days)
            'Dim c_date2 As DateTime = DateTime.Now
            Dim constr6 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Using conn As New SqlConnection(constr6)
                'Dim sqlstring = "Select * from record_table WHERE subject Is Not NULL And datalength(subject) > 0 And  (prime_resp_name=@user_id or sec_resp_name=@user_id)  order by id desc"
                'Session("laststring") = sqlstring

                Using cmd8 As New SqlCommand("Select * from insu_dtl where emp_name=@user_text order by id desc")
                    'Using cmd8 As New SqlCommand("Select * from record_table WHERE subject Is Not NULL And datalength(subject) > 0 And id=@days")
                    cmd8.Parameters.AddWithValue("@user_text", name)

                    cmd8.CommandType = CommandType.Text
                    cmd8.Connection = conn
                    Using sda2 As New SqlDataAdapter(cmd8)
                        Dim ds2 As New DataSet()
                        sda2.Fill(ds2)

                    End Using
                End Using
            End Using
            'pnscomm.Parameters.AddWithValue("@due_date", CDate(txtSelectedDate.Text))
            'Dim name1 As String = (TextBox8.Text).ToString
            Dim constr1 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Dim sqlstring = "Select * from insu_dtl where emp_name=@user_text order by id desc order by id desc"
            Session("laststring") = sqlstring
            Using conn As New SqlConnection(constr1)
                Using cmd1 As New SqlCommand("Select * from insu_dtl where emp_name=@user_text order by id desc")

                    cmd1.Parameters.AddWithValue("@user_text", name)
                    'cmd1.CommandType = CommandType.Text
                    cmd1.Connection = conn
                    Using sda1 As New SqlDataAdapter(cmd1)
                        Dim ds1 As New DataSet()
                        sda1.Fill(ds1)
                        GridView1.DataSource = Nothing
                        GridView1.DataSource = ds1.Tables(0)
                        GridView1.DataBind()
                        Dim dt As New DataTable()
                        dt = ds1.Tables(0)
                        Session("Test") = dt


                    End Using
                End Using
            End Using

        End If
        'Dim name1 As String = (TextBox8.Text).ToString



    End Sub

    Protected Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs)
        Dim flag As String
        flag = "Y"
        Dim constr6 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Using conn As New SqlConnection(constr6)


            Using cmd8 As New SqlCommand("Select * from insu_dtl where flag=@flag order by id desc")
                'Using cmd8 As New SqlCommand("Select * from record_table WHERE subject Is Not NULL And datalength(subject) > 0 And id=@days")
                cmd8.Parameters.AddWithValue("@flag", flag)

                cmd8.CommandType = CommandType.Text
                cmd8.Connection = conn
                Using sda2 As New SqlDataAdapter(cmd8)
                    Dim ds2 As New DataSet()
                    sda2.Fill(ds2)

                End Using
            End Using
        End Using

        Dim constr1 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
        Dim sqlstring = "Select * from insu_dtl where flag=@flag order by id desc"
        Session("laststring") = sqlstring
            Using conn As New SqlConnection(constr1)
            Using cmd1 As New SqlCommand("Select * from insu_dtl where flag=@flag order by id desc")

                cmd1.Parameters.AddWithValue("@flag", flag)
                'cmd1.CommandType = CommandType.Text
                cmd1.Connection = conn
                Using sda1 As New SqlDataAdapter(cmd1)
                    Dim ds1 As New DataSet()
                    sda1.Fill(ds1)
                    GridView1.DataSource = Nothing
                    GridView1.DataSource = ds1.Tables(0)
                    GridView1.DataBind()
                    Dim dt As New DataTable()
                    dt = ds1.Tables(0)
                    Session("Test") = dt


                End Using
            End Using
        End Using


        'Dim name1 As String = (TextBox8.Text).ToString


    End Sub

    Protected Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs)

        Dim flag As String, flag1 As String
        flag = "R"
        flag1 = "N"

        Dim constr6 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Using conn As New SqlConnection(constr6)


            Using cmd8 As New SqlCommand("Select * from insu_dtl where flag IN('N','R') order by id desc")
                'Using cmd8 As New SqlCommand("Select * from record_table WHERE subject Is Not NULL And datalength(subject) > 0 And id=@days")
                cmd8.Parameters.AddWithValue("@flag", flag)
                cmd8.Parameters.AddWithValue("@flag1", flag1)

                cmd8.CommandType = CommandType.Text
                cmd8.Connection = conn
                Using sda2 As New SqlDataAdapter(cmd8)
                    Dim ds2 As New DataSet()
                    sda2.Fill(ds2)

                End Using
            End Using
        End Using
            'pnscomm.Parameters.AddWithValue("@due_date", CDate(txtSelectedDate.Text))
            'Dim name1 As String = (TextBox8.Text).ToString
            Dim constr1 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
        Dim sqlstring = "Select * from insu_dtl where flag IN('N','R') order by id desc"
        Session("laststring") = sqlstring
            Using conn As New SqlConnection(constr1)
            Using cmd1 As New SqlCommand("Select * from insu_dtl where flag IN('N','R') order by id desc")
                cmd1.Parameters.AddWithValue("@flag", flag)
                cmd1.Parameters.AddWithValue("@flag1", flag1)
                'cmd1.Parameters.AddWithValue("@user_text", name)
                'cmd1.CommandType = CommandType.Text
                cmd1.Connection = conn
                Using sda1 As New SqlDataAdapter(cmd1)
                    Dim ds1 As New DataSet()
                    sda1.Fill(ds1)
                    GridView1.DataSource = Nothing
                    GridView1.DataSource = ds1.Tables(0)
                    GridView1.DataBind()
                    Dim dt As New DataTable()
                    dt = ds1.Tables(0)
                    Session("Test") = dt

                    ' DropDownList2.DataTextField = "topic"
                    'DropDownList2.DataValueField = "topic"
                    'GridView1.DataBind()
                End Using
            End Using
        End Using


        'Dim name1 As String = (TextBox8.Text).ToString


    End Sub


    Public Sub send_message()
        Dim flag As String = "N"
        Dim Claim_type As String = "B"
        Dim days As Integer = 15
        Dim days1 As Integer = 30
        Dim c_date As DateTime = DateTime.Now.AddDays(days)
        Dim c_date3 As DateTime = DateTime.Now.AddDays(days1)
        Dim c_date2 As DateTime = DateTime.Now
        'Session("c_date1") = c_date
        Session("c_date23") = c_date2
        Dim oldDay As Integer = Microsoft.VisualBasic.DateAndTime.Day(c_date2)
        If oldDay = 1 Then
            'Dim days As Integer = 15
            'Session("c_date") = DateTime.Now.AddDays(days)
            Session("c_date3") = DateTime.Now.AddDays(days1)
            Dim constr6 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
            Using conn As New SqlConnection(constr6)
                ' Dim sqlstring = "Select * from insu_dtl WHERE ins_valid>@c_date2 And ins_valid<=@c_date2 AND flag=@flag AND claim_type = @claim"
                'Session("laststring") = sqlstring
                'dl_valid Between @start_date And @end_date


                conn.Open()
                Using cmd8 As New SqlCommand("Select user_id from insu_dtl WHERE ins_valid Between @c_date And @c_date2 ")
                    cmd8.Parameters.AddWithValue("@c_date", c_date2)
                    cmd8.Parameters.AddWithValue("@c_date2", Session("c_date3"))
                    'cmd8.Parameters.AddWithValue("@flag", flag)
                    'cmd8.Parameters.AddWithValue("@claim", Claim_type)
                    cmd8.CommandType = CommandType.Text
                    cmd8.Connection = conn



                    objreader1 = cmd8.ExecuteReader()
                    If objreader1.HasRows Then
                        Do While objreader1.Read()

                            Session("emp_no") = objreader1("user_id").ToString()
                            'Response.Write(Session("emp_name"))
                            'Response.Write("working")
                            callname()
                        Loop
                    Else
                        Response.Write(" no row")
                    End If

                End Using
            End Using

            'c_date = DateTime.Now.AddDays(days)
            'Session("c_date1") = c_date
        Else
            c_date = DateTime.Now.AddDays(days)
        End If
        'Response.Write(c_date)
    End Sub

    Public Sub callname()

        'Response.Write(Session("emp_no"))

        Dim constr6 As String = ConfigurationManager.ConnectionStrings("cmdpns").ConnectionString
        Using conn As New SqlConnection(constr6)



            conn.Open()
            Using cmd8 As New SqlCommand("Select mobile_no from user_table WHERE user_id=@user ")
                cmd8.Parameters.AddWithValue("@user", Session("emp_no"))

                cmd8.CommandType = CommandType.Text
                cmd8.Connection = conn



                objreader = cmd8.ExecuteReader()
                If objreader.HasRows Then
                    Do While objreader.Read()

                        Session("mobile_no") = objreader("mobile_no").ToString()
                        connect()
                        'Response.Write("working")
                        'callname()
                    Loop
                Else
                    Response.Write(" no row")
                End If


            End Using
        End Using

        'c_date = DateTime.Now.AddDays(days)
        'Session("c_date1") = c_date

    End Sub

    Public Sub connect()
        Dim MyConnObj As New ADODB.Connection
        Dim myRecSet As New ADODB.Recordset 'Recordset Object
        Dim sqlStr As String ' String variable to store sql command


        Dim DatabaseName As String = "ntpcumsgapp"
        Dim server As String = "10.1.215.70"
        Dim userName As String = "dreamsolmb"
        Dim password As String = "ntpc@1234"
        Dim msg_date As Date = DateTime.Now.Date
        Dim msg_time As String = DateTime.Now.ToString("HH:mm:ss")
        'If Not conn Is Nothing Then conn.Close()
        conn1.ConnectionString = String.Format("server={0}; user id={1}; password={2}; database={3}; pooling=false", server, userName, password, DatabaseName)
        Try
            conn1.Open()

            'MsgBox("Connected")
        Catch ex As Exception
            ' MsgBox(ex.Message)
        End Try
        ' Dim curr_date As String
        ' Dim curr_time As String
        Dim now As DateTime = DateTime.Now


        Dim mobile_no As String = CStr(Session("mobile_no").ToString().Replace("'", ""))
        'mobile_no.Trim() = Session("mobile_no").ToString
        Dim msg As String = "FINAL TEST. Please check."
        Dim curr_date1 As String = CStr("2016" + "-" + "08" + "-" + "29")
        Dim curr_time1 As String = CStr("21" + ":" + "00" + ":" + "00")
        Dim comm As MySqlCommand = conn1.CreateCommand()
        'comm.CommandText = "INSERT INTO msg_stats(msisdn , msg, status,date,time,user,grp_name) VALUES(@mob,@person, 0, @mdate,@mtime,'Auto','Test')"
        ' comm.CommandText = "INSERT INTO msg_stats( msisdn,msg,date,time,status,user,grp_name) values('" + mobile_no + "','" + msg + "','" + curr_date1 + "','" + curr_time1 + "',0,'Auto','Test')"
        comm.CommandText = "INSERT INTO msg_stats(msisdn , msg, status,Date,time,user,grp_name) VALUES('" + mobile_no + "','Please submit Insurance Document at the earliest.-HR', 0,'2016-08-29','20:51:00','Auto','Test')"
        ' comm.Parameters.AddWithValue("@mob", Session("prime_mobile"))
        ' comm.Parameters.AddWithValue("@person", "'You have a new task'")
        'comm.Parameters.AddWithValue("@address", "0")
        ' comm.Parameters.AddWithValue("@mdate", "'2016-08-29'")
        ' comm.Parameters.AddWithValue("@mtime", "'20:51:00'")
        comm.ExecuteNonQuery()

        'cmd.Parameters.AddWithValue("@VARUN", "Varun")
        'cmd.Parameters.AddWithValue("@Kapoor", "Kapoor")
        'cmd.ExecuteNonQuery()
        conn1.Close()
        'End Using
    End Sub



    Protected Sub LinkButton1_Click(sender As Object, e As EventArgs)
        Response.Redirect("~/downloadfile.aspx")


    End Sub






End Class

 


Posted 2 months ago
dharmendr says:
Also let me know which line you are getting the error.

 


Posted 2 months ago

while i m changing the grid page i m getting this error


Posted 2 months ago

Hi manoj07,

Insert break point in Bindlast method and check in which line you are getting the error.

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html