Accesing aSQL view from C#



When I try to access a SQL Saved view calleed FilteredLead I do not get anythin back on asp.net if I run same SQL command on the SQL Editor I get all my results. Is it any way to use views in C# diffrent than tables ?

See my code



MyString = "SELECT * from FilteredLead";
//where fullname like '%ja%'
SqlConnection myConnection = new SqlConnection("server=TEST;database=CRMTEST_MSCRM;UID=Joe;PWD=xxxx");

SqlCommand myCommand = new SqlCommand(MyString, myConnection);
SqlDataReader reader;

string tempTotal = "";

try
{
myConnection.Open();
reader = myCommand.ExecuteReader();
while (reader.Read())
{
Response.Write(reader[0].ToString());
}
}
catch (SqlException ex)
{
Response.Write(ex.ToString());
}





Thanks

.



Relevant Pages

  • Re: newbie question (SQL)
    ... The SQL would look like this: ... table1_id FROM Table2)"; ... SqlConnection myConnection = new SqlConnection(<your connection string ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Transfer an SQL database?
    ... Finally I have made some optimizations. ... take the result of the COUNT query in SQL. ... SqlConnection myConnection = new SqlConnection("Initial ...
    (microsoft.public.dotnet.languages.csharp)
  • Accesing SQL View form C# asp.net
    ... When I try to access a SQL Saved view calleed FilteredLead I do not get anythin back on asp.net if I run same SQL command on the SQL Editor I get all my results. ... SqlConnection myConnection = new ... SqlDataReader reader; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Reference for database handling in windows forms using C#.Net
    ... public static string Transaction(string sql, string conn) ... SqlConnection myConnection = new SqlConnection; ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: SBS2003 Standard - managing the SQL installation?
    ... information for how to use SQL command line for MSDE 2000: ... 325003 How To Manage the SQL Server Desktop Engine (MSDE 2000) by Using the ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)