當前位置: 首頁>>代碼示例>>C#>>正文


C# DataTable.ToString方法代碼示例

本文整理匯總了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;
 }
開發者ID:jarrod-h,項目名稱:ActiveVideoGame,代碼行數:27,代碼來源:UserDAL.cs

示例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());
     }
 }
開發者ID:pedrosouzax,項目名稱:Roteirizador,代碼行數:10,代碼來源:Form_mostrar_populcao.cs

示例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()");
        }
開發者ID:esdkp,項目名稱:esdkp,代碼行數:18,代碼來源:TableViewer.cs

示例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()");
        }
開發者ID:esdkp,項目名稱:esdkp,代碼行數:18,代碼來源:AddRemoveDialog.cs

示例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;
        }
開發者ID:gigapr,項目名稱:DatabaseExplorer,代碼行數:19,代碼來源:ForeignKeyMapper.cs

示例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()");
        }
開發者ID:esdkp,項目名稱:esdkp,代碼行數:21,代碼來源:AppAltDialog.cs

示例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);
            }
        }
開發者ID:rnanda,項目名稱:Dex,代碼行數:38,代碼來源:MainWindow.xaml.cs

示例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 = "";
            }
        }
開發者ID:heyitstanyado,項目名稱:MemoryCalculator,代碼行數:24,代碼來源:Form1.cs

示例9: GetXmlSchema

 private string GetXmlSchema(DataTable dt)
 {
     using (var writer = new StringWriter())
     {
         dt.WriteXmlSchema(writer);
         return dt.ToString();
     }
 }
開發者ID:xiangyuan,項目名稱:Unreal4,代碼行數:8,代碼來源:JsonSerializer.cs

示例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());
		}
開發者ID:symform,項目名稱:mono,代碼行數:11,代碼來源:DataTableTest.cs

示例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;
        }
開發者ID:martinherr3,項目名稱:medusa-biodata,代碼行數:33,代碼來源:GereralFunctions.cs

示例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()");
        }
開發者ID:esdkp,項目名稱:esdkp,代碼行數:9,代碼來源:Raid.cs

示例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");
            }
        }
開發者ID:FloodCode,項目名稱:MonsterBot,代碼行數:14,代碼來源:McBot.cs


注:本文中的System.Data.DataTable.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。