📄 getarticleid.cs
字号:
using System;
using System.Data;
using System.Configuration;
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.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
/// <summary>
/// Summary description for GetArticleId
/// </summary>
public class GetArticleId:DataAccess
{
public int articleid;
public int number;
public GetArticleId()
{
//
// TODO: Add constructor logic here
//
}
public int GetArticleId_number_admin(int UserId)
{
//SqlCommand comm = new SqlCommand();
//conn.Open();
//comm.CommandType = CommandType.StoredProcedure;
//comm.CommandText = "User_SelectArticleId";
//comm.Connection = conn;
//SqlDataAdapter sda = new SqlDataAdapter(comm);
//DataSet ds = new DataSet();
//DataTable dt = new DataTable();
//try
//{
// sda.Fill(ds, "UserId_Register");
// dt = ds.Tables["UserId_Register"];
//}
//catch (SqlException e)
//{
// String error_string = e.ToString();
// conn.Close();
// return dt;
//}
//conn.Close();
//return dt;
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectArticleIdAdminbyEnvoyer";
comm.Connection = conn;
comm.Parameters.Add("@UserId", SqlDbType.Int).Value = UserId;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "ArticleId_fromEnvoyers");
dt = ds.Tables["ArticleId_fromEnvoyers"];
number = dt.Rows.Count;
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return number;
}
public int GetArticleId_Articles()
{
//SqlCommand comm = new SqlCommand();
//conn.Open();
//comm.CommandType = CommandType.StoredProcedure;
//comm.CommandText = "User_SelectArticleId";
//comm.Connection = conn;
//SqlDataAdapter sda = new SqlDataAdapter(comm);
//DataSet ds = new DataSet();
//DataTable dt = new DataTable();
//try
//{
// sda.Fill(ds, "UserId_Register");
// dt = ds.Tables["UserId_Register"];
//}
//catch (SqlException e)
//{
// String error_string = e.ToString();
// conn.Close();
// return dt;
//}
//conn.Close();
//return dt;
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectArticleId";
comm.Connection = conn;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "ArticleId_formArticles");
dt = ds.Tables["ArticleId_formArticles"];
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
for (int j = 0; j <=dt.Columns.Count - 1; j++)
articleid = Convert.ToInt32(dr[0].ToString());
}
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return articleid;
}
public int GetArticleId_number_admin_2(int UserId)
{
//SqlCommand comm = new SqlCommand();
//conn.Open();
//comm.CommandType = CommandType.StoredProcedure;
//comm.CommandText = "User_SelectArticleId";
//comm.Connection = conn;
//SqlDataAdapter sda = new SqlDataAdapter(comm);
//DataSet ds = new DataSet();
//DataTable dt = new DataTable();
//try
//{
// sda.Fill(ds, "UserId_Register");
// dt = ds.Tables["UserId_Register"];
//}
//catch (SqlException e)
//{
// String error_string = e.ToString();
// conn.Close();
// return dt;
//}
//conn.Close();
//return dt;
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectArticleIdAdminByExperts";
comm.Connection = conn;
comm.Parameters.Add("@UserId", SqlDbType.Int).Value = UserId;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "ArticleId_fromEnvoyers");
dt = ds.Tables["ArticleId_fromEnvoyers"];
number = dt.Rows.Count;
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return number;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -