protected override void Render(HtmlTextWriter AOutput) { string LExpression; if (Request["table"] != null) { LExpression = String.Format("select {0};", Request["table"]); } else { if (Request["query"] != null) { LExpression = Request["query"]; } else { throw new Exception("You must set a \"table\" or \"query\" CGI variable."); } } DAEConnection LConn = new DAEConnection(); LConn.Open((IServer)Session["DataServer"], (IServerSession)Session["DataServerSession"], (IServerProcess)Session["DataServerProcess"]); DAEDataAdapter LAdapter = new DAEDataAdapter(LExpression, LConn); DataSet LDataSet = new DataSet(); LAdapter.Fill(LDataSet); Response.ContentType = "text/xml"; Response.Write("<?xml version=\"1.0\"?>\r\n"); LDataSet.WriteXml(Response.OutputStream, XmlWriteMode.WriteSchema); }
public void OpenConnection() { DAEConnection LConnection; string connectionString = "LocalInstance"; using (LConnection = new DAEConnection(connectionString)) { LConnection.Open(); using (DbCommand LCommand = LConnection.CreateCommand()) { LCommand.Connection = LConnection; LCommand.CommandText = "select Libraries group add {Count() LibCount}"; var LCount = LCommand.ExecuteScalar(); Console.WriteLine(LCount.GetType()); Console.WriteLine(LCount); } } }
private void Execute(ExportType exportType, string fileName) { // Make sure our server is connected... Dataphoria.EnsureServerConnection(); using (var statusForm = new StatusForm(Strings.Exporting)) { using (var connection = new DAEConnection()) { if (DesignerID == "SQL") { SwitchToSQL(); } try { using (var adapter = new DAEDataAdapter(GetTextToExecute(), connection)) { using (var dataSet = new DataSet()) { var process = DataSession.ServerSession.StartProcess(new ProcessInfo(DataSession.ServerSession.SessionInfo)); try { connection.Open(DataSession.Server, DataSession.ServerSession, process); try { switch (exportType) { case ExportType.Data: adapter.Fill(dataSet); dataSet.WriteXml(fileName, XmlWriteMode.IgnoreSchema); break; case ExportType.Schema: adapter.FillSchema(dataSet, SchemaType.Source); dataSet.WriteXmlSchema(fileName); break; default: adapter.Fill(dataSet); dataSet.WriteXml(fileName, XmlWriteMode.WriteSchema); break; } } finally { connection.Close(); } } finally { DataSession.ServerSession.StopProcess(process); } } } } finally { if (DesignerID == "SQL") { SwitchFromSQL(); } } } } }