Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}Sets an ADO.NET DataTable as a data source to bind to template data markers.{excerpt}
{signature:C#}
public void BindData(System.Data.DataTable dataTable, String dataSourceName, PowerPointWriter.DataBindingProperties bindingProperties)
{signature}{signature:vb.net}
Public Overridable Sub BindData(ByVal dataTable As System.Data.DataTable, ByVal dataSourceName As String, ByVal bindingProperties As DataBindingProperties
{signature}
{parameters}
{param:dataTable}The DataTable to use as the data source.{param}
{param:dataSourceName}The name of the data source.{param}
{param:bindingProperties}A DataBindingProperties object.{param}
{example}{code:csharp|title=C#}
          OleDbConnection Conn = new OleDbConnection();
          DataTable EmployeeDt = null;
          DataBindingProperties dataProps = pptt.CreateDataBindingProperties();
          try
          {
               Conn.ConnectionString = Application["connstring"].ToString();
 
               //--- SQL Query for employee information
               string EmployeeSQL = "SELECT FirstName + ' ' + " +
                    "LastName As Name, Title " +
                    "FROM Employees WHERE EmployeeID=?";
               OleDbCommand CmdEmployee = new OleDbCommand(EmployeeSQL, Conn);
               CmdEmployee.Parameters.Add("@EmployeeID", EmployeeId);
               OleDbDataAdapter AdptEmployee = new OleDbDataAdapter(CmdEmployee);
               EmployeeDt = new DataTable();
               AdptEmployee.Fill(EmployeeDt);
          }
          pptt.BindData(EmployeeDt,
               "Employee",
               dataProps);
{code}
{code:vbnet|title=vb.net}
          Dim Conn As New OleDbConnection()
          Dim EmployeeDt As DataTable = Nothing
          Dim dataProps As DataBindingProperties = pptt.CreateDataBindingProperties()
          Try
               Conn.ConnectionString = Application("connstring").ToString()

               '--- SQL Query for employee information
               Dim EmployeeSQL As String = "SELECT FirstName + ' ' + " & _
                    "LastName As Name, Title " & _
                    "FROM Employees WHERE EmployeeID=?"
               Dim CmdEmployee As New OleDbCommand(EmployeeSQL, Conn)
               CmdEmployee.Parameters.Add("@EmployeeID", EmployeeId)
               Dim AdptEmployee As New OleDbDataAdapter(CmdEmployee)
               EmployeeDt = New DataTable()
               AdptEmployee.Fill(EmployeeDt)
          End Try
          pptt.BindData(EmployeeDt, _
               "Employee", _
               dataProps)
{code}
{example}