HI,
In the above code nowhere ur creating any file, and from nowhere ur reading any file.
Here is the solution :
protected void btnCreate_Click(object sender, EventArgs e)
{
FileStream createFile = new FileStream(@"C:\Docs\file2.docx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
createFile.Close();
StreamWriter sw = new StreamWriter(@"C:\Docs\file2.docx");
sw.Write("Tajuddin............");
sw.Close();
StreamReader sr=new StreamReader (@"c:\docs\file2.docx");
string fileData=sr.ReadToEnd ();
sr.Close();
string sqlquery = string.Format("insert into filee values('{0}','{1}')", "123", fileData);
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=Mith;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand(sqlquery, con);
cmd.ExecuteNonQuery();
}