|
mschotamaster wrote: sql2008
I have a table
Aight, first you'd need a Sql-statement to select the value you're interested in. Something like this
SELECT [connType]
FROM [Login]
WHERE [Id] = @Id
mschotamaster wrote: i want to fetch connType value of the logged user to do like this
Open a <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx">SqlConnection</a>[<a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx" target="_blank" title="New Window">^</a>] (using a correct connectionstring[^]), create a <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx">SqlCommand</a>[<a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx" target="_blank" title="New Window">^</a>] , put the Sql-statement in the CommandText property, add the parameter, open the connection, and catch the result from the ExecuteScalar [^]-method.
Bastard Programmer from Hell
|
|
|
|
|
|
My pleasure
|
|
|
|
|
if the user is logged in as you say, you must already have read the table to identify him, so you already know how to obtain data from a table.
|
|
|
|
|
That's what I thought also.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
hi
I have on the form a datagrid that user information is entered as a factor. Now I want to print the invoice. It is this good? Is how do I do?
|
|
|
|
|
Your question made no sense at all as written. You haven't given any coherent details about what you've done, how you've done it or what your code is supposed to do beside print an invoice.
|
|
|
|
|
http://www.stimulsoft.com/ReportsNet.aspx
|
|
|
|
|
I developed an application in C # where I have 4 text boxes and a datagrid with 4 columns and multiple rows and a button.
The button should generate an xml file.
I can create the xml file and write the data from text boxes, but not the DataGrid.
Anyone can help me?
At this moment i have this code:
In the button action
XmlTextWriter writer = new XmlTextWriter("teste.xml", Encoding.GetEncoding("ISO-8859-1"));
Writer.Formatting = Formatting.Indented;
// for the textboxes:
WriteStartElement("textbox1");
WriteElementString(textbox1.text);
WriteEndElement();
WriteStartElement("textbox2");
WriteElementString(textbox2.text);
WriteEndElement();
WriteStartElement("textbox3");
WriteElementString(textbox3.text);
WriteEndElement();
WriteStartElement("textbox4");
WriteElementString(textbox4.text);
WriteEndElement();
WriteStartElement("textbox4");
WriteElementString(textbox4.text);
WriteEndElement();
For the datadridview xml output strutured shoud be like this:
<Tabela>
<Tabela-Linha numero="1">
<Id>01</id>
<Nome>Teste1</Nome>
<Cargo>xxx</Cargo>
<Extensao>500</Extensao>
</Tabela-Linha>
<Tabela-Linha numero="2">
<Id>02</id>
<Nome>teste2</Nome>
<Cargo>xxxx</Cargo>
<Extensao>501</Extensao>
</Tabela-Linha>
</Tabela>
Can anyone help me?
|
|
|
|
|
How about foreaching the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.rows.aspx">Rows</a>[<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.rows.aspx" target="_blank" title="New Window">^</a>] collection of the grid, writing the contents of all the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.columns.aspx">Columns</a>[<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.columns.aspx" target="_blank" title="New Window">^</a>] using the method you already used?
object value = dataGridView1.Rows[RowIndex].Cells[ColumnIndex].Value;
Bastard Programmer from Hell
|
|
|
|
|
How about using a serializable object as the datasource for the grid then serialize the object?
|
|
|
|
|
Does .NET Framework 4.0 have every thing in it that .NET Framework 2.0 has. If I have a program that worked on .Net Framework 2.0 will it necessarily work on .Net Framework 4.0.
Regards,
Michael
|
|
|
|
|
|
And to be safe you really need to fully test it.
|
|
|
|
|
Microsoft has a very good track record when it comes to backward compatibility. So, it must work barring some minor issues. Check the link in the first answer for known issues.
|
|
|
|
|
Mostly, but some things have been obsolesced, which makes developing for multiple versions difficult.
One example:
Reader = new System.Xml.XmlReaderSettings()
{
ValidationType = System.Xml.ValidationType.Schema
,
# if DotNet_2_0 || DotNet_3_0 || DotNet_3_5
ProhibitDtd = false
# endif
# if DotNet_4_0
DtdProcessing = System.Xml.DtdProcessing.Parse
# endif
,
XmlResolver = new System.Xml.XmlUrlResolver()
{
Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
}
} ;
And unfortunately there are no built-in macroes defined for the version so you have to define your own.
|
|
|
|
|
Hi Guys,
I have a PictureBox control in a WinForms application where I need to display the image at the maximum height allowable by the screen size without changing the image's height to width relationship.
The Picture box is docked to the right of the form. Setting the image height is easy enough but calculating the width is problematic as screen pixels aren't square.
How can I calculate the width with the image displayed to it's maximum height without distorting the image? I don't know the actual screen measurements; only the resolution.
Thanks......
|
|
|
|
|
Have you tried setting the PictureBox's SizeMode property to Zoom??
|
|
|
|
|
I don't think you can unless the height to width ratio of the picture box exactly matches that of the image. Your resulting image will either be distorted or too wide/narrow for the picture box. This article[^] explains the issue and offers a solution which may help you; the code is C++ but should be easy to understand.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
PictureBoxSizeMode.Zoom will perform an isotropic rescale such that the image fits one or both dimensions of the PB without clipping.
MSDN explains it rather well here[^].
|
|
|
|
|
Thanks; isn't it just so easy in C#?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks. The solution shown in the C++ article shows how to size the image and then it's just a matter of setting the PictureBox ClientSize to the image size. This seems to size the image correctly and maintains the ratio.
|
|
|
|
|
And, as Luc pointed out above, the PictureBox looks after things automatically.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Yeah, it's about the only useful feature it offers.
I can't understand why people insist on painting on top of a PB, then find it difficult to correlate mouse location with picture pixels.
|
|
|
|
|
Probably because they don't make proper use of the documentation.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|