本文整理匯總了C#中System.Data.DataTable.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.ToString方法的具體用法?C# DataTable.ToString怎麽用?C# DataTable.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Data.DataTable
的用法示例。
在下文中一共展示了DataTable.ToString方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: selectUser
public DataTable selectUser(string Username)
{
SqlConnection con = new SqlConnection(constr);
SqlCommand com = new SqlCommand("select_user");
SqlDataAdapter adp = new SqlDataAdapter(com);
DataTable userData = new DataTable();
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@Username", Username);
com.Connection = con;
try
{
con.Open();
//System.Diagnostics.Debug.Write("HERE 1");//DEBUG
adp.Fill(userData);
}
catch(Exception ex)
{
throw ex;
}
finally
{
System.Diagnostics.Debug.Write("HERE 2");
con.Close();
}
System.Diagnostics.Debug.Write("HERE 3: "+userData.ToString());
return userData;
}
示例2: Form_mostrar_populcao_Load
private void Form_mostrar_populcao_Load(object sender, EventArgs e)
{
dt = new DataTable();
for(int i = 0; i< ds.Tables.Count; i++)
{
dt= ds.Tables[i].Clone(); //Tabela recebe dados XML
listView1.Items.Add(dt.ToString());
}
}
示例3: TableViewer
public TableViewer(frmMain owner, DataTable dt)
{
#if (DEBUG_1||DEBUG_2||DEBUG_3)
debugLogger = new DebugLogger("frmTable.log");
#endif
debugLogger.WriteDebug_3("Begin Method: frmTable.frmTable(frmMain,DataTable) (" + owner.ToString() + "," + dt.ToString() + ")");
this.owner = owner;
local=true;
InitializeComponent();
dataGrid.ReadOnly = true;
dbTable = dt;
dataGrid.SetDataBinding(dbTable,"");
this.dbTable.RowChanged += new DataRowChangeEventHandler(dbTable_Changed);
this.dbTable.RowDeleted += new DataRowChangeEventHandler(dbTable_Changed);
debugLogger.WriteDebug_3("End Method: frmTable.frmTable()");
}
示例4: AddRemoveDialog
public AddRemoveDialog(frmMain owner, DataTable dt, int addOrRemove, string raidname, DateTime date)
{
#if (DEBUG_1||DEBUG_2||DEBUG_3)
debugLogger = new DebugLogger("frmAddRemove.log");
#endif
debugLogger.WriteDebug_3("Begin Method: frmAddRemove.frmAddRemove(frmMain,DataTable,int,string,DateTime) ("
+ owner.ToString() + "," + dt.ToString() + "," + addOrRemove.ToString() + "," + date.ToShortDateString() + ")");
InitializeComponent();
this.owner = owner;
cboPeople.DataSource = dt;
cboPeople.DisplayMember = "Name";
lblRaid.Text = "Raid: " + raidname;
lblDate.Text = "Date: " + date.Month + "/" + date.Day + "/" + date.Year;
if (addOrRemove == ADD) { btnAddRemove.Text = "Add"; add = true; }
else if (addOrRemove == REMOVE) { btnAddRemove.Text = "Remove"; add = false; }
debugLogger.WriteDebug_3("End Method: frmAddRemove.frmAddRemove()");
}
示例5: MapToForeignKey
public ForeignKey MapToForeignKey(DataRow row, DataTable schema)
{
var dbForeignKey = new ForeignKey
{
Name = row["FK_NAME"].ToString(),
OriginalName = row["FK_NAME"].ToString(),
ForeignKeyTableName = row["FK_TABLE_NAME"].ToString(),
PrimaryKeyTableName = row["PK_TABLE_NAME"].ToString(),
ForeignKeyTableSchema = schema.ToString()
};
var fkc = new ForeignKeyColumn { Name = row["FK_COLUMN_NAME"].ToString() };
dbForeignKey.ForeignKeyColumns.Add(fkc);
var pkc = new PrimaryKeyColumn { Name = row["PK_COLUMN_NAME"].ToString() };
dbForeignKey.PrimaryKeysColumns.Add(pkc);
return dbForeignKey;
}
示例6: AppAltDialog
public AppAltDialog(frmMain owner, string name, DataTable dt)
{
#if (DEBUG_1||DEBUG_2||DEBUG_3)
debugLogger = new DebugLogger("frmAppAlt.log");
#endif
debugLogger.WriteDebug_3("Begin Method: frmAppAlt.frmAppAlt(frmMain,string,DataTable) (" + owner.ToString() +
"," + name.ToString() + "," + dt.ToString() + ")");
InitializeComponent();
this.owner = owner;
this.name = name;
lblNotFound.Text = name + " not found in database. Who is s/he?";
cboPeople.DataSource = dt;
cboPeople.DisplayMember = "Name";
rdoApp.Checked = true;
cboClass.Items.AddRange( new object[] { "BER", "BRD", "BST", "CLR", "DRU", "ENC",
"MAG", "MNK", "NEC", "PAL", "RNG", "ROG",
"SHD", "SHM", "WAR", "WIZ" });
debugLogger.WriteDebug_3("End Method: frmAppAlt.frmAppAlt()");
}
示例7: MainWindow
public MainWindow()
{
InitializeComponent();
string pokedex_filepath = filepath + "pokedex\\data\\csv\\";
try
{
using (StreamReader sr = new StreamReader(pokedex_filepath + "pokemon_species.csv"))
{
string data = sr.ReadToEnd();
sr.Close();
List<string> lines = new List<string>(data.Split('\n'));
string[] colnames = lines[0].Split(',');
lines.RemoveAt(0);
DataTable Species = new DataTable("Species");
foreach (string colname in colnames)
Species.Columns.Add(new DataColumn(colname));
foreach (string line in lines)
{
DataRow dr = Species.Rows.Add();
dr.ItemArray = line.Split(',');
}
Species.ToString();
}
}
catch (Exception ex)
{
AddLog("Something went wrong.", MessageType.Error);
}
}
示例8: equals_Click
private void equals_Click(object sender, EventArgs e)
{
try
{
input = this.resultWindow.Text;
object result = new DataTable().Compute(input, null);
this.resultWindow.Text = result.ToString();
addToHistory(input);
updateResultHistory();
input = "";
}
catch
{
this.resultWindow.Text = "ERROR";
addToHistory(input);
updateResultHistory();
input = "";
}
}
示例9: GetXmlSchema
private string GetXmlSchema(DataTable dt)
{
using (var writer = new StringWriter())
{
dt.WriteXmlSchema(writer);
return dt.ToString();
}
}
示例10: 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.AreEqual (cmpr, dt.ToString());
}
示例11: ConvertDataTableToXML
//public static bool ValidarCodigoPostal(string pCodigo)
//{
// int i;
// for (i = 0; i <= pCodigo.Length - 1; i++)
// {
// if (Information.IsNumeric(pCodigo(i)))
// {
// return true;
// }
// }
// return false;
//}
public static string ConvertDataTableToXML(DataTable dtBuildSQL)
{
DataSet dsBuildSQL = new DataSet();
StringBuilder sbSQL;
StringWriter swSQL;
string XMLformat;
sbSQL = new StringBuilder();
swSQL = new StringWriter(sbSQL);
dsBuildSQL.Merge(dtBuildSQL);//, true, MissingSchemaAction.AddWithKey);
dsBuildSQL.Tables[0].TableName = dtBuildSQL.ToString();
foreach (DataColumn col in dsBuildSQL.Tables[0].Columns)
{
col.ColumnMapping = MappingType.Attribute;
}
dsBuildSQL.WriteXml(swSQL, XmlWriteMode.WriteSchema);
XMLformat = sbSQL.ToString();
return XMLformat;
}
示例12: UpdateLoot
public void UpdateLoot(DataTable dt)
{
debugLogger.WriteDebug_3("Begin Method: Raid.UpdateLoot(DataTable) (" + dt.ToString() + ")");
foreach (DataRow r in dbRaid.Select("(PTS<0)")) { dbRaid.Rows.Remove(r); }
foreach (DataRow r in dt.Rows) { dbRaid.Rows.Add(r.ItemArray); }
debugLogger.WriteDebug_3("End Method: Raid.UpdateLoot()");
}
示例13: Math
void Math(Id id, string text)
{
Dialogue dialogue = Sessions[id];
try
{
var result = new DataTable().Compute(text, null);
botClient.SendReply(id.chat_id, MessageId(dialogue), result.ToString());
}
catch
{
botClient.SendReply(id.chat_id, MessageId(dialogue), "I can't solve this");
}
}