GetFilename()方法出现问题,请大家帮帮忙

来源:百度知道 编辑:UC知道 时间:2024/05/10 23:33:03
public bool AddMsg(string title, string user, int categoryid)
{
string filename = GetFilename().ToString();
xmlfilename = GetFilename().ToString();
DateTime time = DateTime.Now;
Int32 count = 0;
DateTime Lreplytim = DateTime.Now;

string sql = "INSERT INTO BBSInfo VAlUES('" + title + "','" + filename + "','" + time + "','" + count + "','" + Lreplytim + "','" + user + "','" + categoryid + "')";
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
conn.Open();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = sql;
int val = cmd.EndExecuteNonQ

public bool AddMsg(string title, string user, int categoryid)
{
try
{
string filename = GetFilename().ToString();
xmlfilename = GetFilename().ToString();
}
catch(Exception ex)
{ }
DateTime time = DateTime.Now;
Int32 count = 0;
DateTime Lreplytim = DateTime.Now;

string sql = "INSERT INTO BBSInfo VAlUES('" + title + "','" + filename + "','" + time + "','" + count + "','" + Lreplytim + "','" + user + "','" + categoryid + "')";
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
conn.Open();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = sql;
int val = cmd.EndExecuteNonQuery(null);
if (val > 0)
return true;
e