本文整理汇总了C#中DataTable.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DataTable.ToString方法的具体用法?C# DataTable.ToString怎么用?C# DataTable.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTable
的用法示例。
在下文中一共展示了DataTable.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e) //获取全部的Family
{
if (!this.IsPostBack)
{
DataTable fy = new DataTable();
fy = uph.GetUPHFamily();
var q = from r in fy.AsEnumerable()
select new ListItem(r[0].ToString());
string FY = fy.ToString();
this.Select3.Items.AddRange(q.ToArray());
bindbullTable(null,20);
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
bindbullTable(null, 20);
if (!IsPostBack)
{
DataTable fy = new DataTable();
fy = uph.GetLine1();
var q = from r in fy.AsEnumerable()
select new ListItem(r[0].ToString());
string FY = fy.ToString();
this.DL_PdLine.Items.AddRange(q.ToArray());
bindbullTable(null, 20);
}
DataTable sn = new DataTable();
sn = uph.GetAlarmALL();
bindbullTable(sn, 5);
}
示例3: ToStringTest
public void ToStringTest()
{
DataTable dt = new DataTable();
dt.Columns.Add("Col1", typeof(int));
dt.TableName = "Mytable";
dt.DisplayExpression = "Col1";
string cmpr = dt.TableName + " + " + dt.DisplayExpression;
Assert.Equal(cmpr, dt.ToString());
}
示例4: insertNewUser
public void insertNewUser(User userInput)
{
using (SqlConnection sqlCon = new SqlConnection(connectionstring))
{
String userName = userInput.UserName;
string sql = "SELECT UserId FROM Users WHERE Email = '" + userName + "'";
sqlCon.Open();
SqlCommand command = new SqlCommand(sql, sqlCon);
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
DataRow dr = dt.NewRow();
response.message = dt.ToString();
if (dt != null && dt.Rows.Count > 0) // Email id is duplicate
{
response.status = "error";
response.message = "Email id already exits";
}
else
{
int id = getLastInsertedUserId();
String token = generateUniqueToken();
if (token != "error")
{
doInsert(userInput, (id + 1), token);
}
else
{
response.status = "error";
response.message = "There was an error processing your request";
}
sqlCon.Close();
}
}
}
示例5: generateUniqueToken
public String generateUniqueToken()
{
using (SqlConnection sqlCon = new SqlConnection(connectionstring))
{
string sql = "SELECT NEWID()";
sqlCon.Open();
SqlCommand command = new SqlCommand(sql, sqlCon);
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
DataRow dr = dt.NewRow();
response.message = dt.ToString();
if (dt != null && dt.Rows.Count > 0) // Email id is duplicate
{
DataRow row = dt.Rows[0];
return row[0].ToString();
}
else
{
return "error";
}
}
}
示例6: verify
public void verify(User userInput)
{
using (SqlConnection sqlCon = new SqlConnection(connectionstring))
{
String userId = userInput.UserId;
String token = userInput.Token;
string sql = "SELECT UserId FROM Users WHERE UserId = '" + userId + "' and token = '" + token + "' and verified = 'N'";
sqlCon.Open();
SqlCommand command = new SqlCommand(sql, sqlCon);
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
DataRow dr = dt.NewRow();
response.message = dt.ToString();
if (dt != null && dt.Rows.Count > 0)
{
updateVerificationStatus(userId, token);
}
else
{
response.status = "error";
response.message = "This user has already been verified or this is an incorrect link";
}
sqlCon.Close();
}
}