ToString() public method

Returns the and , if there is one as a concatenated string.
public ToString ( ) : string
return string
Beispiel #1
5
 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;
 }
Beispiel #2
0
 public string Datatable(System.Data.DataTable dt)
 {
     foreach (DataRow row in dt.Rows)
     {
         var title = row["unit_title"].ToString();
     }
     return(dt.ToString());
 }
 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());
     }
 }
Beispiel #4
0
 private void userButton14_Click(object sender, EventArgs e)
 {
     if (CheckExpressionValid(richTextBox1.Text))//字符串合法
     {
         var result = new System.Data.DataTable().Compute(richTextBox1.Text, "");
         richTextBox1.Text += ("=" + result.ToString());
     }
     else
     {
         MessageBox.Show("请输入合法的表达式");
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataTable"></param>
        /// <param name="elementType"></param>
        /// <param name="tableFunc"></param>
        /// <param name="columnMapping"></param>
        public void AddTS(System.Data.DataTable dataTable, Type elementType = null, System.Linq.Expressions.Expression <Func <string, string> > tableFunc = null, Dictionary <string, string> columnMapping = null)
        {
            changeInternalDbProvider(elementType);
            TransactionScopeBulkCopyEntity entity = new TransactionScopeBulkCopyEntity()
            {
                DataTable     = dataTable,
                ColumnMapping = columnMapping,
                TableName     = elementType == null ? dataTable.TableName : elementType.GetEntityName(),
                TableFunc     = tableFunc,
            };

            if (string.IsNullOrEmpty(dataTable.TableName))
            {
                throw new DMSFrameException(dataTable.ToString() + "未指定表名进行批量导入数据库!");
            }
            TransactionScopeEntityList.Enqueue(entity);
        }
Beispiel #6
0
        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()");
        }
Beispiel #7
0
        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()");
        }
        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;
        }
Beispiel #9
0
        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()");
        }
Beispiel #10
0
        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);
            }
        }
Beispiel #11
0
        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 = "";
            }
        }
Beispiel #12
0
 private string GetXmlSchema(DataTable dt)
 {
     using (var writer = new StringWriter())
     {
         dt.WriteXmlSchema(writer);
         return dt.ToString();
     }
 }
Beispiel #13
0
		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());
		}
        //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;
        }
Beispiel #15
0
        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()");
        }
Beispiel #16
0
        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");
            }
        }