using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;public partial class company_view_result : System.Web.UI.Page
{
private static string strconn = ConfigurationManager.AppSettings["dsn"];
private SqlConnection IDConnection = new SqlConnection(strconn);
protected void Page_Load(object sender, EventArgs e)
{
if (!Session.IsNewSession && Session.Contents["ComID"] != null)
{
Label2.Text = Session["ComID"].ToString();
Label1.Text = Convert.ToString(company_view_company_resume.contt()).Trim();
}
else
{
Response.Redirect("~/company/company_index.aspx");
}
if (!Page.IsPostBack)
{
submit1.Attributes.Add("onclick", "return check();");
}
}
protected void submit1_Click(object sender, EventArgs e)
{
SqlCommand myCommand = new SqlCommand(null, IDConnection);
myCommand.CommandText = "insert into CompanyContact(Data,Name,Phone) values(@Data,@Name,@Phone)";
string data = Request.Form["data"];
string ConnectPerson = Request.Form["name"];
int ComPhoneNO = System.Convert.ToInt32(Request.Form["phone"]);
myCommand.Parameters.AddWithValue("@Data", data);
myCommand.Parameters.AddWithValue("@Name", ConnectPerson);
myCommand.Parameters.AddWithValue("@Phone", ComPhoneNO);
IDConnection.Open();
myCommand.ExecuteNonQuery();
IDConnection.Close(); }
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;public partial class company_view_result : System.Web.UI.Page
{
private static string strconn = ConfigurationManager.AppSettings["dsn"];
private SqlConnection IDConnection = new SqlConnection(strconn);
protected void Page_Load(object sender, EventArgs e)
{
if (!Session.IsNewSession && Session.Contents["ComID"] != null)
{
Label2.Text = Session["ComID"].ToString();
Label1.Text = Convert.ToString(company_view_company_resume.contt()).Trim();
}
else
{
Response.Redirect("~/company/company_index.aspx");
}
if (!Page.IsPostBack)
{
submit1.Attributes.Add("onclick", "return check();");
}
}
protected void submit1_Click(object sender, EventArgs e)
{
SqlCommand myCommand = new SqlCommand(null, IDConnection);
myCommand.CommandText = "insert into CompanyContact(Data,Name,Phone) values(@Data,@Name,@Phone)";
string data = Request.Form["data"];
string ConnectPerson = Request.Form["name"];
int ComPhoneNO = System.Convert.ToInt32(Request.Form["phone"]);
myCommand.Parameters.AddWithValue("@Data", data);
myCommand.Parameters.AddWithValue("@Name", ConnectPerson);
myCommand.Parameters.AddWithValue("@Phone", ComPhoneNO);
IDConnection.Open();
myCommand.ExecuteNonQuery();
IDConnection.Close(); }
}
解决方案 »
- 关于静态页面生成原理
- 奇怪的事,哪位帮我试一下,这个脚本怎么会被执行了两次
- 我刚接触asp.net和c#,有很多问题,希望大家能帮我一下!谢谢了!
- 在线考试系统的问题
- 我使用WebBrowser批量生成网站缩略图时如果遇到直接是下载地址的域名会弹出保存框
- 初级问题(up有分):在dataGrid中的dropdownlist怎么进行数据邦定,以及选中默认值
- 用正则获取整个<table></table>之间的数据
- 请各位帮我看下下面的程序啊,急!
- 请问如何让DataList里被选中的Item排列到前面,或者自动滚动让它们可见?
- 请问安装了oracle_net.msi,为什么用.net(c#)写时(using system.data.oracle_clicent)中系统仍然找不到此类!是不是还需要什么配置!
- js验证提交数据库问题。
- ViewState能否储存日期类型?为何我会出错呢?
在form里加上runat=server的话就可以插入数据库,但不能js验证.如果runat=server不加的话就能js验证.但是插入不进数据库