What I tried to do is generating a text file on ASP.Net using C#. The data is retrived from a database by executing a stored procedure. I ensured that the stored procedures returned values by executing it in SQL server Mangement studio. I was actually able to do just that.
I first gether all related tables into a View then using stored procedure to get data from that View. Then generate that data into text file in ASP.Net. using the following code:
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Name"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("Stored Procedure Name", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter myAdapter = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
myAdapter.Fill(dt);
System.Text.StringBuilder strResult = new System.Text.StringBuilder("");
string createtext = (Server.MapPath("./Feeds/") + "feed.txt");
StreamWriter w = File.CreateText(createtext);
w.Flush();
w.Close();
I ensured that every View returned values as well (in SQL manament studio).
But the problem is that not all stored procedures returned values on the ASP.Net I only get blank text file eventhough all stored procedures returned some values in SQL server Mangement studio.
I only use a simple select statement in the storeprocedures like
select Somthing form View_Name
This query returns some value in the Management Studio, but not ASP.Net (for some stored procedures).
what would be the issue for this problem. Please help