|
Ain't me babe wrote: but here is datagrid
Ain't me babe wrote: I have a datagridview
First, DataGridView is not the same thing as DataGrid. So make sure you know exactly which you are using.
Second, there exists perfectly fine documentation for both, freely available, on the MSDN site. See this for DataGridView.[^] You should have no difficulties finding your solution by reading that documentation. Good luck.
led mike
|
|
|
|
|
Hi all,
i have arequirement to import excel sheet to postgresql using C#.
i wrote a code:
try
{
connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" + txtfilename.Text + ";" + "Extended Properties=Excel 8.0;");
mycommand = new OleDbDataAdapter(@"select * from [Ranjit$]", connection);
mydataset = new DataSet();
mycommand.Fill(mydataset, "ExcelInfo");
try
{
dataGridView1.DataSource = mydataset.Tables["ExcelInfo"].DefaultView;
}
catch (Exception ex)
{
//System.Diagnostics.Debug.WriteLine(ex.GetBaseException().ToString());
//MessageBox.Show(ex.GetBaseException().ToString());
throw new Exception(ex.Message);
}
So mydataset is displaying data in datagridview. this is working fine
No i have to send data to postgresql database
For that i wrote code
NpgsqlConnection strconn = new NpgsqlConnection(@"server=localhost;user id=postgres;password=thinksoft10@;database=Test;SyncNotification=true ");
strconn.Open();
NpgsqlCommand cmd = new NpgsqlCommand("COPY \"Test\" FROM STDIN", strconn);
NpgsqlCopyIn cin = new NpgsqlCopyIn(cmd, strconn);
cin.start();
but this is copying files to the database.
So please tell me how to copy that information in the postgresql database.
in my application i am able to show the excel sheet data in datagrid.
but i am not aable to send the excel sheet data to postgresql Test database test table.
Any help is appreciated!!!
thanks in anticipation
Ranjit.balu
|
|
|
|
|
If you already have the data correctly in a datagrid, can't you simply iterate the data in the datagrid and using INSERT INTO statement put the data into the database.
Note: If that's a real username and password in your connection string, I believe you don't want to share them with us.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hello,
Where are the button images (move first, move last etc)
associated with the bindingNavigator buttons ?
I've tried a search, but cannot find them.
thanks
pcjd
|
|
|
|
|
They are set in designer generated file. The images are stored in resx file.
|
|
|
|
|
Thank you for your reply Giorgi,
but let me explain a little further.
I have one project where the bindingnavigator button
images are present, and yes they reside in the resx file.
However, I have a second project which has a bindingnavigator
and the button images are not present. So how can I load them ?
With the project that has the images, the image property of
each button has System.Drawing.Bitmap as the value.
How (or where) can I load these images into my new project ?
(without cutting and pasting from the original resx file)
thanks
pcjd
|
|
|
|
|
Hi,
I have a AxWebBrowser hosted inside a form. How can I notify the form whenever the user changes the selections in the comboBoxes hosted inside the browser?
thanx
|
|
|
|
|
Does anybody know how I can give my application a custom color that is not available in visual studio (Sort of like how you do it in html).
Prateek
|
|
|
|
|
If you know RGB code of the color you can use Color.FromARGB() method to get the color you want. If you want to allow user choose color they need, you can use ColorDialog.
|
|
|
|
|
It took me a while to get the rgb value, but that worked.
Thanks again
Prateek
|
|
|
|
|
Glad to help you
|
|
|
|
|
I'm trying to generate an Excel 2003 compatible XML file using the XMLSerializer. I've seen a couple articles on this but I've not seen one yet that shows how to create the <"mso-application progid="Excel.Sheet"?> line just after the line. The XMLSerializer will create the version line and pretty much everything else I need but I can't seem to find anything in it that will let me generate the line that tells the OS to open the file with Excel.
I would really like to use the XMLSerializer as my only other choice seems to be just building the XML totally from scratch.
Any help is greatly appreciated.
Thanks,
TxPomeroy
|
|
|
|
|
Just modify the output manually after using the XMLSerializer.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I have a series of combo boxes (17 in all) each with a list of names for selection. Each name has its own colour. The names reflect who is/could be on duty during a particular time period.
So when I select Barbara from the list in combo 1 I want that combo's text background colour to be set to light blue. If Gretchen is selected in combo 2 I want to use light green in combo 2. I have a click event which manages this part. using a case statement to detemine name/colour.
When I load the combo box at program start up, everything is fine,each person has their own colour.
If I now change the name in combo 2 from gretchen (green) to Sabrina (light salmon) The text changes but the colour does not. If I click on another combo box or again in the same combo box then the colour for Sabrina changes.
Am I missing something.
|
|
|
|
|
Here is the code in the Event Handler
private void cboCMs_EventHandler(object sender, EventArgs e)
{
ComboBox box = sender as ComboBox;
box.SuspendLayout();
switch (box.Text)
{
case "Barbara":
box.BackColor = System.Drawing.Color.LightBlue;
break;
case "Gretchen":
box.BackColor = System.Drawing.Color.LightGreen;
break;
case "Sabrina":
box.BackColor = System.Drawing.Color.LightYellow;
break;
case "Joanne":
box.BackColor = System.Drawing.Color.LightPink;
break;
case "Not Played":
box.BackColor = System.Drawing.Color.LightSalmon;
break;
case "No CM":
box.BackColor = System.Drawing.Color.Magenta;
break;
case "No BR":
box.BackColor = System.Drawing.Color.MediumOrchid;
break;
default:
break;
}
box.Update();
box.ResumeLayout();
}
|
|
|
|
|
I know what I'm doing is a big no-no on the forums, but I feel my original thread got pushed back a couple of pages to due recent spam (html template crap). I did get one answer, but I feel a little short sighted to be able to make proper use of it, so this thread can actually be seen as a clarification of it...
Problem:
my GUI thread calls a worker thread which has an infinite loop monitoring for changes / commands which may trigger another GUI Form. Obviously I want to keep all my GUI stuff on the same thread, so how would be the proper / best way to get that form activated on the original GUI thread?
Suggested answer: look into .Invoke which left me shortsighted, as stated above looking for any clarification.
|
|
|
|
|
|
In any public methods of your user interface add code that looks a bit like this:
<br />
public void setText(string someText)<br />
{<br />
if (InvokeRequired)<br />
{<br />
Invoke((MethodInvoker)delegate() { setText(someText); });<br />
return;<br />
}<br />
MyLabel.Text = someText;<br />
}<br />
Basically the method invokes itself if needed otherwise it just gets on with it. If the method has been invoked then the invoke will not be required and the method just continues
Russ
|
|
|
|
|
I found the following strange problem for tabcontrol:
when I set the tab button location to left or right, then the text on the button does not display, however, if set tab button location to top or bottom, it does display. Also, I found this problem only happens on different computers.
does anyone meet this problem?
thanks.
|
|
|
|
|
I have a feeling that this is happening probably because of the way all the objects are ordered. Can you show a screen shot of your application?
|
|
|
|
|
This is probably a really easy question, but i need to select a value from an SQL table and put it in a string.
The table - PRODUCTS, has a column called QTY and a column called ID
I need to select the QTY value where ID = x.
How do i select the single value and put it into a string?
|
|
|
|
|
I am not sure if what you have asked is this simple but:
How about building an SqlCommand (System.Data.SqlClient.SqlCommand or SqlCommandBuilder)
SELECT QTY FROM PRODUCTS WHERE ID = 'x'
You may need to search through MSDN to learn how to use these classes.
Always keep the Murphy Rules in mind!
|
|
|
|
|
Ok. How do i get the result into a string?
|
|
|
|
|
|
How to publish the project in a way that the user can select the directory to be installed in and other options.
this is all the software does. but I do not know how to do it such as in VC#.
if I just publish one project,during install, it does not let you select where you will install and so on.
thanks.
|
|
|
|