.net - How do I create or mimic SQL Server Management Studio query results report -


In the SQL Server Management Studio, you can generate a query result for the grid (default setting) , Query results appear directly below it Alternatively, you can output query results to a file, which you want to get the RPT file anywhere.

SQL server result in file

Report file looks something like this (When opened in Notepad);

report file

My question is, how do I How do I create the same type of file (same file format, transfer and all) in NET? I am using VBNET.)

It has been with me using the Enterprise Library so far, but it gives a dataset, out of which I withdraw a dataview. I can convert the data file to a text file, but this text file does not look like this report file, from which I do not even know how it has been decided to format it.

`dmcmandrfrapeer dbcmand wadper as

  dbCommandWrapper = GlobalDatabase.objDatabase.GetStoredProcCommandWrapper (" My_StoredProcedure_Report ") return to IsNothing (objGlobalDatabase.objTransaction) then return to GlobalDatabase.objDatabase.ExecuteDataSet ( DbCommandWrapper) .Tables (0) .DefaultView () or Return GlobalDatabase ObjDatabase.ExecuteDataSet (dbCommandWrapper, objGlobalDatabase.objTransaction) .Tables (0) .DefaultView () End if ` 
< P>

There is nothing more than a formatted text to see the results of the management. You need to get the dim column 'Save Index / Index' in the form of the new code (int, int), for the integer = 0, I have the integer = 0 as DataTable.Columns.count - 1 column . Add (i, 1) Load the next slow data '' values ​​as new dim list (string list) and calculate as int for width = 0 to DataTable.Rows.Count-1 cols As the new list (string of) in the form of DataTable.Column.Count- 1 slow cl from integer = 0, save your string values ​​here, if not, then the debil (datatile .ro (rows) (Cols)) then Dim value string = convert.trstring () (DataTable.Rows (rows)) if val.Length & gt; Column (Column) then Column (Column) = Val Longline end if CL.Ed (WAL) and CL.Ad (string.meta) finally add the next data.Now (CL) Next

Now, print out your output

  blurred sb as new stringbilder () for 'I' as header = 0 to Datatable.Columns.count - 1 sb.Append ( Datatable.Columns (i) .columnName.PadRight (column (i), "_")) sb.Append ("") "The location between the columns next to sb.Append (Environment.NewLine) As I list (list as (For the string)) i as the data for integer = 0 to l.count sb.Append (l. I) .Padright (column (i))) sb.Append ("") "between the space column next sb For example  Courier New          > 

WARNING: The code typed from typed memory and NIT should be displayed, but it should represent what you are looking for


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -