新天堂2 套装外观:string cn = System.Configuration.ConfigurationManager.AppSettings["Connstring"];
来源:百度文库 编辑:高考问答 时间:2024/06/01 11:26:02
string cn = System.Configuration.ConfigurationManager.AppSettings["Connstring"];
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString = cn;
oSQLConn.Open();
str = "select Area from CusTomer_newresourceall where mobilno='" + mobile.Text.Trim().Substring(1, 6) + "'";
SqlCommand comm = new SqlCommand(str, oSQLConn);
string area = Convert.ToString(comm.ExecuteScalar());
if (area == "")
{
area = "其它";
}
string strr = "insert into CusTomer_guest (mobilno,content,guestname,area,marktime,kfxm) values ('" + mobile.Text.Trim() + "',' 没填','无','" + area + "',getdate(),'" + Session["kfxm"] + "')";
SqlCommand inst = new SqlCommand(strr, oSQLConn);
try
{
inst.ExecuteNonQuery();
string message = "数据添加成功!!";
this.Response.Write("<body onload=" + "javascript:alert('" + message + "');" + ">");
Panel2.Visible = false;
Panel1.Visible = true;
db();
}
catch
{
string message = "数据添加失败!!";
this.Response.Write("<body onload=" + "javascript:alert('" + message + "');" + ">");
}
finally
{
oSQLConn.Close();
}
}
else { Response.Redirect("display.aspx"); }
帮我精简一下代码,指点一下
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString = cn;
oSQLConn.Open();
str = "select Area from CusTomer_newresourceall where mobilno='" + mobile.Text.Trim().Substring(1, 6) + "'";
SqlCommand comm = new SqlCommand(str, oSQLConn);
string area = Convert.ToString(comm.ExecuteScalar());
if (area == "")
{
area = "其它";
}
string strr = "insert into CusTomer_guest (mobilno,content,guestname,area,marktime,kfxm) values ('" + mobile.Text.Trim() + "',' 没填','无','" + area + "',getdate(),'" + Session["kfxm"] + "')";
SqlCommand inst = new SqlCommand(strr, oSQLConn);
try
{
inst.ExecuteNonQuery();
string message = "数据添加成功!!";
this.Response.Write("<body onload=" + "javascript:alert('" + message + "');" + ">");
Panel2.Visible = false;
Panel1.Visible = true;
db();
}
catch
{
string message = "数据添加失败!!";
this.Response.Write("<body onload=" + "javascript:alert('" + message + "');" + ">");
}
finally
{
oSQLConn.Close();
}
}
else { Response.Redirect("display.aspx"); }
帮我精简一下代码,指点一下
string cn = System.Configuration.ConfigurationManager.AppSettings["Connstring"];
怎样把std::string 转化为System::string
String str=new String("string")
c++builder 中 AnsiString如何转string?
.net(C#)中String.Format如何使用
error C2440: 'initializing' : cannot convert from 'std::string' to 'System::String ^'
String s = new String("xyz");创建了几个String Object?
用C语言printf()怎么输出string型?整型是%d,那么string型的是%?
CH2=C(CN)-COO-C2H5的中文读法
C语言 #include "string.h" 的 意思