SqlConnection conn; conn = new SqlConnection(); conn.ConnectionString = @"Data Source=Param-PC;Initial Catalog=HMS;Persist Security Info=True;User ID=sa;Password=123"; conn.Open(); string query; SqlCommand SqlCommand; SqlDataReader reader; SqlDataAdapter adapter = new SqlDataAdapter(); query = "SELECT Reg_No,convert(nvarchar(10),Reg_Date,103) as Reg_Date, Patient_Name, Contact_No, Department_Name, convert(nvarchar(10),Date,103) as Date, Advance_Amt FROM In_Patients where Patient_Name='" + TextBox1.Text + "'"; SqlCommand = new SqlCommand(query, conn); adapter.SelectCommand = new SqlCommand(query, conn); reader = SqlCommand.ExecuteReader(); GridView1.DataSource = reader; GridView1.DataBind(); reader.Close();
SqlCommand = new SqlCommand(query, conn); SqlDataAdapter da=new sqldataadapter(SqlCommand ); Dataset ds=new Dataset(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); reader.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)