繁简字的转换

来源:互联网 发布:unity3d 弹出对话框 编辑:程序博客网 时间:2024/05/16 19:31
 

 protected void Button1_Click(object sender, EventArgs e)
    {
        string str = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
        using (SqlConnection sqlcnn = new SqlConnection(str))
        {
            using (SqlCommand sqlcmm = sqlcnn.CreateCommand())
            {

                this.TextBox2.Text = "";          //在下一次用之前先清理一下!
                sqlcnn.Open();
                for (int i = 0; i < Convert.ToInt32(this.TextBox1.Text.Length); i++)
                {
                    string text = this.TextBox1.Text;
                    string wordzhong = text.Substring(i, 1);             \\截取你要转换的每个字符,一个一个的去截取

                    sqlcmm.CommandText = "select wordfan from word where id=(select id where wordzhong='" + wordzhong + "')";
                    SqlDataReader reader = sqlcmm.ExecuteReader();
                    if (reader.Read())
                    {
                       
                            this.TextBox2.Text+= reader["wordfan"].ToString();                \\把截取的字符一个一个的加起来!                          
                    }
                    reader.Close();
                }
              
              
            }
        }
    }

原创粉丝点击