Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

results of a query 1

Status
Not open for further replies.

cmsbuffet

Programmer
Feb 3, 2009
173
CA
Code:
Dim command As String
        command = "Select @ZipcodeID As ZipcodeID"
        Page.Response.Write(" " + command + " ")
        Dim cmd As SqlCommand
        cmd = New SqlCommand(command)
        Page.Response.Write(" " + command + " ")
       
        cmd.Parameters.AddWithValue("@ZipcodeID", TextBoxZipcode.Text)
        Page.Response.Write(" " + TextBoxZipcode.Text + " ")
page.response.write ( Here syntax of the result of the query )

How do I do the last line? Perhaps, a table, but how? Thanks.
 
You have to get your results into an object, like a dataset or a datatable. Then you can bind that object to a control like a datagrid, repeater, datalist, etc.
 
Not really, because you have to query the database first, and get that resultset into a dataset/datatable.

Look into this first:

This is a dataaccess block that will help you connect to your database and get/update insert data etc. Once you have the results, you can bind to the grid, repeater etc.
 
Are there any tutorials on how to use dataaccess block that could be helpful?
 
I downloaded DAAB. Found a tutorial. The tutorial uses syntax
Code:
try{
}catch(Exception ex){
}
end try
As in Java. But the correct syntax in ASP is
Code:
  Try
  Catch(Exception ex)

            trow ex;

        End Try
Yet, this does give errors too. Weird. What do I do?
 
The code below suggest to do something with data reader, what can I do with it?
Code:
Database db = DatabaseFactory.CreateDatabase();

string query = "Select * from Customers Where CustomerID = @CustomerID";

DBCommandWrapper command = db.GetSqlStringCommandWrapper(query);

command.AddInParameter("@CustomerID", DbType.String, id);

using (IDataReader reader = db.ExecuteReader(command))
{
    // Do Something...
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top