Ok how do you recommend getting the data from sql server database into the application if you do not recommend the use of datasets?
JollyMansArt
Posts
-
Learning Datasets... -
Learning Datasets...If someone has a better idea in how I can do this please let me know. Normally I what I would do is call sqlreader and each field I would put into a custom array to use through out the application. Well now that I have learned how to create a dataset, while in code without using the vs customized dataset's interface...
string connectionString = TheSQLConnectionString.ConnectionString.ToString();
//DataSet dtSet = new DataSet();
//SqlConnection connection;
using (connection = CreateConn())
{
command = new SqlCommand(TheSQLCommand, connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dtSet);
}Now what I want to be able to do is take the (dtSet) dataset and in code read each row and each row's columns of data. However I want to place this code in a class Passing the parameters (table, row, and column) and I want the class procedure to return the value. Can someone point me in the right direction please in how to understand datasets in order to accomplish this? Thanks in advance.
-
Looking for pointers...I am about to embark on creating a service for the first time. Does anyone have any good pointers or reading material that will help me understand how to code a service? I am very familiar with Application based apps with user and nonuser interaction. But a service I am not to familiar with though I do know the services function vs a applications function. Second Question... In building a service I need for a mechanism for a application to pass a command or paramater to the service and have the service return the results of the command or parameter to the application. Does anyone have any pointers on how I can accomplish this?
-
splitContainer controlI just need to know how to enforce 1 panel's minimum size.
-
Please help. Printing datagridview issue...Found the solution
StringFormat CellFormat = new StringFormat();
//CellFormat.Trimming = StringTrimming.Word;
CellFormat.FormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoClip | StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical;
CellFormat.Alignment = StringAlignment.Center;g.DrawString(column.HeaderText,
cell.Font(scale),
new SolidBrush(cell.ForeColor()),
CellBounds,
CellFormat);The StringFormatFlags.DirectionVertical transforms the text vertically. Their is no need to picture draw the text vertically.
-
Nested if statementsI agree.
-
splitContainer controlThanks, That is what I figured :(... As that was the only way I could get it to work and drop the margins to maximize used space. Quick question though... On this control how to you fix 1 of the partitions sizes to a minimum size. Here is what I tried but it is not working.
if (scRPTFilter1.Panel2.Height != 275)
{
scRPTFilter1.Panel2.Height = 275;
}
if (scRPTFilter1.Panel2.Width != 557)
{
scRPTFilter1.Panel2.Width = 557;
}I was thinking I needed to say something like
if (scRPTFilter1.Panel2.Height != 275)
{
scRPTFilter1.Panel2.Height = new size(275, scrptfilter1.panel2.width);
}Just Not Sure since the height is separated here.
-
splitContainer controlIs there a split container control that will allow the user the ability to resize the control during the applications runtime environment. And will allow for more than 2 split panels. As the SplitContainer control I can only see it allowing 2 containers. I need at least 3 or 4 containers to be resizable. Without having to next the containers inside each other.
-
Please help. Printing datagridview issue...I have learned a lot doing this project with datagrid views. But I have one issue though minor to me is a major issue to the client. I have been working on this for over 2 weeks and can not find any examples to give me the output I am looking for. Please Help any Ideas please: What I need to be able to do is essentially print my database grid column header names vertically at a 90.0F angle. Not horizontally as the default. I have learned how to do this to the grid itself so it prints correctly on the screen. Which is:
private void dgvReport_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{if (e.RowIndex == -1 && e.ColumnIndex >= 4) { e.PaintBackground(e.ClipBounds, true); Rectangle rect = this.dgvReport.GetColumnDisplayRectangle(e.ColumnIndex, true); Size titleSize = TextRenderer.MeasureText(e.Value.ToString(), e.CellStyle.Font); if (this.dgvReport.ColumnHeadersHeight < titleSize.Width) this.dgvReport.ColumnHeadersHeight = titleSize.Width; e.Graphics.TranslateTransform(0, titleSize.Width); e.Graphics.RotateTransform(-90.0F); e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font, //this.Font, Brushes.Black, new PointF(rect.Y, rect.X)); e.Graphics.RotateTransform(90.0F); e.Graphics.TranslateTransform(0, -titleSize.Width); e.Handled = true; } }
But When I send the grid to the printer the columns are all horizontal not vertical. What can I do to print the columns vertical. Any examples anywhere?
-
Printing a datagridview...What additional information is needed to aid in resolving this issue? I need to be able to print my column names horizontal. I can not seem to figure this out when going to the printer. Please help.
-
Editable data grid view?-How can I call a table from database to view in this grid view
SqlDataAdapter SQL\_Adapter; DataTable dtReport1 = new DataTable(); string SQL\_Command = "SQL STATEMENT GOES HERE" //if (cklbxColumns.Items.Count != 0) //{ SQL\_Command += "'" + strExecutive + "', '" + strToolClass + "'"; //} try { using (SQL\_Conn = new SqlConnection(WhatIsTheSQLConnectionString)) { if (SQL\_Conn.State != ConnectionState.Open) { SQL\_Conn.Open(); } else { SQL\_Conn.Close(); SQL\_Conn.Open(); } //using (SQL\_Adapter = new SqlDataAdapter("SQL STATEMENT GOES HERE", SQL\_Conn)) using (SQL\_Adapter = new SqlDataAdapter(SQL\_Command, SQL\_Conn)) { // Use DataAdapter to fill DataTable SQL\_Adapter.Fill(dtReport1); // 4 // Render data onto the screen // dgvReport = DataGridViewer dgvReport.DataSource = dtReport1; //dgvReport.DataMember = "dtToolStatusboardReport"; dgvReport.Refresh(); gbToolStatusBoard.Refresh(); //ActiveForm.Refresh(); } SQL\_Adapter.Dispose(); } SQL\_Conn.Close(); } catch { return; }
-How can I save the table's final state? (this is a single usered non-online system so performance is not issue, I can appreciate a solution that drops the previous table and creates a new one with the edited data grid view) For this method you would simply export the datatable directly back to the main table after flushing out the data in the origional table.
-
Printing a datagridview...I have several columns I want to print the column headers vertically and not horizontal. I have found a method that works but does not meet the expectations speficied. Option 1) (This way does not meet specifications but does work) - I could loop thru the string placing a carrage return after each letter. Option 2) (This way meets specifications and I can get it to print on the screen. However I can not get it to print onto the printer)
private void dgvReport_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.RowIndex == -1 && e.ColumnIndex >= 4) { e.PaintBackground(e.ClipBounds, true); Rectangle rect = this.dgvReport.GetColumnDisplayRectangle(e.ColumnIndex, true); Size titleSize = TextRenderer.MeasureText(e.Value.ToString(), e.CellStyle.Font); if (this.dgvReport.ColumnHeadersHeight < titleSize.Width) this.dgvReport.ColumnHeadersHeight = titleSize.Width; e.Graphics.TranslateTransform(0, titleSize.Width); e.Graphics.RotateTransform(-90.0F); e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font, //this.Font, Brushes.Black, new PointF(rect.Y, rect.X)); e.Graphics.RotateTransform(90.0F); e.Graphics.TranslateTransform(0, -titleSize.Width); e.Handled = true; } }
This way actually rotates the column headers to ensure their vertical the same as their horizontal. How can I print this way (Option 2) -
Printing a datagridI have a data grid viewer populated from a SQL Server stored procedure which returns any number of columns from a minimum of 4 to a maximum of unknown columns. I need to have the ability to print the entire grid. This I can do. However, to print the grid to specifications -- I need to be able to print it on pages the size of 42x36 and 72x72. -- I need to be able to visually scale the entire grid to one page? Please help. what needs done for this ability?
-
Report Building help please...A little background. I have created a stored procedure in sql server. That will generate a ##temp table, then when the stored procedure is complete with generating the table and filling the table with the data for the report, it will drop the ##temp table. I want to generate a Crystal Report and or Microsoft Reporting Services Report. The report will need to be generate from scratch in code. Which comes to the part I need help with. The table will be a minimum of 2 columns to the maximum amount of columns sql server tables will allow. The First 2 Columns are Hard Coded as: JobNumber int, [Job Name] [nvarchar](100) All the other fields are INT. Because the number columns in the report are not static number of columns. I do not know how to generate the report in code. In the past I would create a xsd and fill the xsd and pre-design the report before with the fields in the xsd. Please I know this is a lot to ask but can someone please give me relevant resources (Websites, Samples, Detailed, Explanation) to research to learn how to accommodate this scenario. I need to know how to create this report, and In the report I need the column names as well (The column names I think I can handle). I can populate a data grid on the form but I am not sure that that is the right way to do this.
-
Dynamiclly creating dynamic tables that have varing amounts of columnsIn MS Sql Server 2005 I want to create a Stored procedure that will generate a report. However I don't want to have to recreate or update stored procedures when the number of columns increase or decrease. Here is what I am needing. I need to create a dynamic table that will increase the number of columns in that table based on the results of the select statement. Sample: Select PartName from Parts --PartName will return anywhere between 5 to 200 results or more. DECLARE @ToolsTrackingBoard as TABLE ( JobNumber int, [Job Name] [nvarchar](100) ...All the additional column names are the names from the (Select partname from Parts) query. ) select * from @ToolsTrackingBoard How can I do this? I have been hunting for days.
-
creating a reportI am wanting to create a crystal report. In doing so I want to point the report to a xsd data object. If there is a better way please let me know. The issue here is their may be 50 to 200 columns on the fly in this report and it may increase over time. I don't want to keep having to modify the application and recompiling to generate the report. So I thought that I would find a way to dynamically create the xsd data object. But I don't know how to do this. Any Suggestions?
-
CheckedListBox how to catch a event.yepper that is what I found also.
-
CheckedListBox how to catch a event.I have it working if the mouse is used to click on the list box using the SelectedValueChanged event. However when someone uses the space bar or to checkmark or uncheckmark an item no envent is raised. How do I catch this change?
-
Passing List to form and back... Help plz.I figured out finally how to pass the array to the child and back... Parrent Form:
using (frmpopupEmailRecipient popupVerifyEmailRecipients = new frmpopupEmailRecipient())
{
popupVerifyEmailRecipients.MyEmailTo = EmailTo;
popupVerifyEmailRecipients.MyEmailCC = EmailCC;if (popupVerifyEmailRecipients.Show() == DialogResult.OK) //How to do this? { } EmailTo = popupVerifyEmailRecipients.MyEmailTo; EmailCC = popupVerifyEmailRecipients.MyEmailCC; }
Child Form:
public partial class frmpopupEmailRecipient : Form
{
public List<String> MyEmailTo;
public List<String> MyEmailCC
}Now optionally I would like for learning instead of just closing the frm... How do I modify the child form to return a dialogresult.ok value?
-
Passing List to form and back... Help plz.I think I might of figured out how to pass the list to the child form. By Adding a Public List in the child form. WOrking on testing that But now I have a somewhat new question.... How do I have the child form return the result of Dialogbox.ok? I have set the child form's ok and cancel button's dialog property to the ok and cancel property. But I am unsure how to pass that to the parent form.