异常详细信息: System.Data.SqlClient.SqlException: 对象名 'intoBus' 无效。
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSys...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class _2 : System.Web.UI.Page
{
static string strConn = "Data Source=(local);Initial Catalog=CheCi;Integrated Security=True";
SqlConnection myConn = new SqlConnection(strConn);
SqlCommand myComm;
protected void Button1_Click(object sender, EventArgs e)
{
string strSql="insert into"+"Bus(BusID,BeginStation,EndStation,ServiceTime,Description)"+
"values(@BusID,@BeginStation,@EndStation,@ServiceTime,@Description)";
myComm = new SqlCommand(strSql, myConn);
myComm.Parameters.Add("@BusID",SqlDbType.VarChar,10);
myComm.Parameters.Add("@BeginStation",SqlDbType.VarChar,20);
myComm.Parameters.Add("@EndStation",SqlDbType.VarChar,20);
myComm.Parameters.Add("@ServiceTime",SqlDbType.VarChar,20);
myComm.Parameters.Add("@Description",SqlDbType.VarChar,50);
myComm.Parameters["@BusID"].Value=txtBusID.Text.Trim();
myComm.Parameters["@BeginStation"].Value=txtBeginStation.Text.Trim();
myComm.Parameters["@EndStation"].Value=txtEndStation.Text.Trim();
myComm.Parameters["@ServiceTime"].Value=txtServiceTime.Text.Trim();
myComm.Parameters["@Description"].Value=txtDescription.Text.Trim();
myConn.Open();
myComm.ExecuteNonQuery();
myConn.Close();
Response.Redirect("Default2.aspx");
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx");
}
} 展开
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class _2 : System.Web.UI.Page
{
static string strConn = "Data Source=(local);Initial Catalog=CheCi;Integrated Security=True";
SqlConnection myConn = new SqlConnection(strConn);
SqlCommand myComm;
protected void Button1_Click(object sender, EventArgs e)
{
string strSql="insert into"+"Bus(BusID,BeginStation,EndStation,ServiceTime,Description)"+
"values(@BusID,@BeginStation,@EndStation,@ServiceTime,@Description)";
myComm = new SqlCommand(strSql, myConn);
myComm.Parameters.Add("@BusID",SqlDbType.VarChar,10);
myComm.Parameters.Add("@BeginStation",SqlDbType.VarChar,20);
myComm.Parameters.Add("@EndStation",SqlDbType.VarChar,20);
myComm.Parameters.Add("@ServiceTime",SqlDbType.VarChar,20);
myComm.Parameters.Add("@Description",SqlDbType.VarChar,50);
myComm.Parameters["@BusID"].Value=txtBusID.Text.Trim();
myComm.Parameters["@BeginStation"].Value=txtBeginStation.Text.Trim();
myComm.Parameters["@EndStation"].Value=txtEndStation.Text.Trim();
myComm.Parameters["@ServiceTime"].Value=txtServiceTime.Text.Trim();
myComm.Parameters["@Description"].Value=txtDescription.Text.Trim();
myConn.Open();
myComm.ExecuteNonQuery();
myConn.Close();
Response.Redirect("Default2.aspx");
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx");
}
} 展开
2个回答
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询