-3
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class Bookcheck : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataAdapter da=new SqlDataAdapter();
SqlConnection cnn=new SqlConnection();
DataSet ds = new DataSet();
string constr = null;
SqlCommand cmd = new SqlCommand();
if (IsValid != null)
{
constr = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =librarymanagement;
Integrated Security=SSPI";
cnn.ConnectionString = constr;
try
{
if (cnn.State != ConnectionState.Open)
cnn.Open();
}
catch (Exception ex)
{
string str1 = null;
str1 = ex.ToString();
}
cmd.Connection = cnn ;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spbookcheck";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("bookid", txtid.Text);
cmd.Parameters.AddWithValue("Nameofthebook", txtnb.Text);
da.SelectCommand=cmd;
try
{
da.Fill(ds);
}
catch (Exception ex)
{
string strErrMsg = ex.Message;
// throw new ApplicationException
}
finally
{
da.Dispose();
cmd.Dispose();
cnn.Close();
cnn.Dispose();
}
if (ds.Tables[0].Rows.Count > 0)
{
Msg.Text = "bookcheck successfully";
Response.Redirect("Issueofbook.aspx");
}
else
{
Msg.Text="bookcheck failed";
}
}
}
}
我的錯誤Asp.net如何糾正錯誤
索引超出範圍異常的未經處理過的用戶無法找到 表0
也許你可以告訴我們你得到了什麼錯誤。 –
@joel Etherton記錄沒有插入,然後錯誤超出範圍異常投擲用戶 – kannan
@joel Etherton頁面運行,然後任何重新插入請幫助我如何更改.... – kannan