怎么数据写不进数据库啊,又没有报错
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
// myConnection.Open();
if (!Page.IsValid)
{
string conn = "server=741FC6DFB4214A2;database=pingou;user id=sa;password=sa ";
SqlConnection myConnection = new SqlConnection(conn);
string sql = "select * from tbTree where ID = '+this.TextBox1.Text+ ' ";
SqlCommand myCommand = new SqlCommand(sql, myConnection);
myConnection.Open();
SqlDataReader myDataReader = myCommand.ExecuteReader();
DataTable dt= new DataTable();
dt.Columns.Add(new DataColumn( "ID ",typeof(string)));
dt.Columns.Add(new DataColumn( "Name ",typeof(string)));
dt.Columns.Add(new DataColumn( "ParentID ",typeof(string)));
while(myDataReader.Read())
{
DataRow dr= dt.NewRow();
dr[0]=myDataReader.GetValue(0).ToString();
dr[1]=myDataReader.GetValue(1).ToString();
dr[2]=myDataReader.GetValue(2).ToString();