当前位置: 首页>>代码示例>>C#>>正文


C# MySqlCommandBuilder.ToString方法代码示例

本文整理汇总了C#中MySql.Data.MySqlClient.MySqlCommandBuilder.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlCommandBuilder.ToString方法的具体用法?C# MySqlCommandBuilder.ToString怎么用?C# MySqlCommandBuilder.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySql.Data.MySqlClient.MySqlCommandBuilder的用法示例。


在下文中一共展示了MySqlCommandBuilder.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateNullTextFieldToEmptyString

        public void UpdateNullTextFieldToEmptyString()
        {
            CreateDefaultTable();
              execSQL("INSERT INTO Test (id, id2, name) VALUES (1, 1, NULL)");

              MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
              MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
              cb.ToString();  // keep the compiler happy

              DataTable dt = new DataTable();
              da.Fill(dt);

              dt.Rows[0]["name"] = "";
              int updateCnt = da.Update(dt);

              Assert.AreEqual(1, updateCnt);

              dt.Rows.Clear();
              da.Fill(dt);

              Assert.AreEqual(1, dt.Rows.Count);
              Assert.AreEqual("", dt.Rows[0]["name"]);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:23,代码来源:DataAdapterTests.cs

示例2: UpdateExtendedTextFields

        public void UpdateExtendedTextFields()
        {
            execSQL("CREATE TABLE Test (id int, notes MEDIUMTEXT, PRIMARY KEY(id))");
              execSQL("INSERT INTO Test VALUES(1, 'This is my note')");

              MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
              MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
              cb.ToString();  // keep the compiler happy
              DataTable dt = new DataTable();
              da.Fill(dt);

              dt.Rows[0]["notes"] = "This is my new note";
              da.Update(dt);

              dt.Clear();
              da.Fill(dt);
              Assert.AreEqual("This is my new note", dt.Rows[0]["notes"]);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:18,代码来源:DataAdapterTests.cs

示例3: Bug5798

        public void Bug5798()
        {
            CreateDefaultTable();
              execSQL("INSERT INTO Test (id, id2, name) VALUES (1, 1, '')");

              MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
              MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
              cb.ToString();  // keep the compiler happy
              DataTable dt = new DataTable();
              da.Fill(dt);

              Assert.AreEqual(String.Empty, dt.Rows[0]["name"]);

              dt.Rows[0]["name"] = "Test";
              da.Update(dt);

              dt.Clear();
              da.Fill(dt);
              Assert.AreEqual("Test", dt.Rows[0]["name"]);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:20,代码来源:DataAdapterTests.cs

示例4: OriginalInName

        public void OriginalInName()
        {
            CreateDefaultTable();
              MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
              MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
              cb.ToString();  // keep the compiler happy
              DataTable dt = new DataTable();
              da.Fill(dt);

              DataRow row = dt.NewRow();
              row["id"] = DBNull.Value;
              row["id2"] = 1;
              row["name"] = "Test";
              row["dt"] = DBNull.Value;
              row["tm"] = DBNull.Value;
              row["ts"] = DBNull.Value;
              row["OriginalId"] = 2;
              dt.Rows.Add(row);
              da.Update(dt);

              Assert.AreEqual(1, dt.Rows.Count);
              Assert.AreEqual(2, dt.Rows[0]["OriginalId"]);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:23,代码来源:DataAdapterTests.cs

示例5: UpdateDataSet

		/// <summary>
		/// Updates the given table with data from the given <see cref="DataSet"/>
		/// </summary>
		/// <param name="connectionString">Settings to use for the update</param>
		/// <param name="commandText">Command text to use for the update</param>
		/// <param name="ds"><see cref="DataSet"/> containing the new data to use in the update</param>
		/// <param name="tablename">Tablename in the dataset to update</param>
		public static void UpdateDataSet( string connectionString, string commandText, DataSet ds, string tablename )
		{
			MySqlConnection cn = new MySqlConnection( connectionString );
			cn.Open();
			MySqlDataAdapter da = new MySqlDataAdapter( commandText, cn );
			MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
			cb.ToString();
			da.Update( ds, tablename );
			cn.Close();
		}
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:17,代码来源:MySqlHelper.cs


注:本文中的MySql.Data.MySqlClient.MySqlCommandBuilder.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。