MACROMEDIA FLASH 8-EXTENDING FLASH Uživatelský manuál Strana 6

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 17
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 5
2003 Macromedia, Inc. 6
Here’s what the code looks like in RemoteCatalog.cs:
using System;
using System.Data.SqlClient;
using System.Data;
using System.Data.OleDb;
namespace samples.remoting
{
public class RemoteCatalog
{
protected System.Data.OleDb.OleDbConnection sqlConnection;
//Get all categories of products
public DataTable getCategories()
{
string sql = "SELECT categoryId, name, image FROM
Category";
GetConnection();
OleDbDataAdapter da = new OleDbDataAdapter(sql,
sqlConnection);
DataSet ds = new DataSet();
da.Fill(ds, "Customers");
return ds.Tables["Customers"];
}
//Get products for one category
public DataTable getProductsByCategory(int catId)
{
string sql = "SELECT productId, name, description,
categoryId, image, price FROM Product WHERE categoryId = " + catId;
GetConnection();
OleDbDataAdapter da = new OleDbDataAdapter(sql,
sqlConnection);
DataSet ds = new DataSet();
da.Fill(ds, "Products");
return ds.Tables["Products"];
}
private void GetConnection()
{
String source1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Inetpub\\wwwroot\\flashremoting\\samples\\db\\sports2000.mdb;";
// get a connection using the connect info that works on
this SDK platform
sqlConnection = new OleDbConnection(source1);
try
{
sqlConnection.Open();
}
catch (Exception)
{
}
}
}
}
Zobrazit stránku 5
1 2 3 4 5 6 7 8 9 10 11 ... 16 17

Komentáře k této Příručce

Žádné komentáře