Mayur  Gujrathi

Mayur Gujrathi

  • 409
  • 3.9k
  • 1m

table 0 not found

Apr 29 2011 1:30 AM
i am calling stored procedure but getting error of table 0 not found
pr_ins_upd_reqdtls is stored procedure name
Dim rowcount As Integer
        Dim ds As DataSet = New DataSet
        Dim cmd As SqlCommand = New SqlCommand
        Dim constr As String = ConfigurationManager.AppSettings("PooledConnectionString")
        Dim sqlcon As SqlConnection = New SqlConnection(constr)
        cmd.Connection = sqlcon
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "pr_ins_upd_reqdtls"
        Dim da As SqlDataAdapter = New SqlDataAdapter("pr_ins_upd_reqdtls", sqlcon)
        da.SelectCommand = cmd
       
       
       

        Dim Var_StrLoginame As String = Session("LoginName")
        cmd.Parameters.AddWithValue("@pa_action", "SEARCHCHK")
        cmd.Parameters.AddWithValue("@pa_tholder", ddlselect.Value)
        If (filter.Value = "I") Then
            cmd.Parameters.AddWithValue("@pa_boid", hdfilter.Value)
            cmd.Parameters.AddWithValue("@pa_req_slip_no", "")
            cmd.Parameters.AddWithValue("@pa_req_date", "")
        ElseIf (filter.Value = "S") Then
            cmd.Parameters.AddWithValue("@pa_boid", "")
            cmd.Parameters.AddWithValue("@pa_req_slip_no", hdfilter.Value)
            cmd.Parameters.AddWithValue("@pa_req_date", "")
        ElseIf (filter.Value = "D") Then
            cmd.Parameters.AddWithValue("@pa_boid", "")
            cmd.Parameters.AddWithValue("@pa_req_slip_no", "")
            Dim pdate As Date
            pdate = ClsDate.GetFormatedDate(hdfilter.Value, "DD/MM/YYYY")
            cmd.Parameters.AddWithValue("@pa_req_date", pdate)
        End If
        cmd.Parameters.AddWithValue("@pa_login_name", Var_StrLoginame)
        'parameters not in use
        cmd.Parameters.AddWithValue("@pa_id", 0)
        cmd.Parameters.AddWithValue("@pa_boname", "")
        cmd.Parameters.AddWithValue("@pa_sholder", "")
        cmd.Parameters.AddWithValue("@pa_chk_yn", 0)
        cmd.Parameters.AddWithValue("@pa_rmks", "")
        cmd.Parameters.Add("@pa_error", SqlDbType.VarChar, 8000)
        cmd.Parameters("@pa_error").DbType = DbType.AnsiString
        cmd.Parameters("@pa_error").Direction = ParameterDirection.Output


        da.Fill(ds, "pr_ins_upd_reqdtls")


        If (Not (ds.Tables(0).Rows.Count > 0)) Then
            rowcount = ds.Tables(0).Rows.Count
            'GridView1.Visible = False
            GridView1.DataSource = ds.Tables(0)
            GridView1.DataBind()
            lblsubheader.Text = "Records Found,  " & rowcount & " "
        ElseIf ds.Tables(0).Rows.Count > 0 Then

Answers (25)