Accesing SQL View form C# asp.net

C

Carlos

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());
}
 
P

parez

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());
}

you could right click and view source.. you are not writing html .. so
it mite not get displayed..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top