Hi
Thanks for your inquiry. Yes of course you can do this. For example see the following code that shows how to open document from data base:
public void Example003()
{
//Create connction
string connectionString = "server=Web1;database=TestDB;uid=sa;pwd=pass;";
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connectionString);
//Create DataSet
DataSet ds = new DataSet();
//Create sql command
string commandString = "SELECT FileContent FROM Documents WHERE ID=1";
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(commandString, conn);
//Create data adapter
System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter(command);
//Open connection
conn.Open();
//Read dataset
adapter.Fill(ds);
conn.Close();
//Save document to hard disk
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
byte[] buffer = (byte[])ds.Tables[0].Rows[0][0];
MemoryStream stream = new MemoryStream(buffer);
Document doc = new Document(stream);
//Do something....
//................
//Do something....
doc.Save(@"C:\Temp\out.doc");
}
}
}
Hope this helps.
Best regards.
Alexey Noskov
Developer/Technical Support
Aspose Auckland Team