|
Vuyiswa Maseko wrote: Thank you very much. i had a LongDay.
that solved my Problem i can go home now
Then you should mark that post as helful.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
How by Voting for it ? i have already done that. or did i miss something
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Vuyiswa Maseko wrote: or did i miss something
No !
Your are done !
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Enjoy your evening.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
OK, you didn't open the connection before you tried to Execute the Reader. So, put a line in before the ExecuteReader to open the conn1 connection object.
conn1.Open();
|
|
|
|
|
hi Dave long time. I have a Function that opens the Connection. This is Where i open the connection
<br />
SqlConnection conn1 = CommonFunctions.getSQLConnectionForThread(THREAD_DATA[0].ToString());
but now my mistake was that in another function i closed this Global Connection and it gave a problem when i tried to execute the reader again later. So d@nish saw it and pointed it out.
Thanks Dave
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Yeah, what they said.
You should go further and Open the Connection before each use and Close it afterward (preferably in a finally).
You can also check the Connection's State and Open it if needed -- that's what I do.
(Working with DataReaders makes this a little more difficult because you have to hold the Connection open and remember to Close it later.)
|
|
|
|
|
You are Right. i have Opened the Connection. i have a Global Connection Module. And when it moved to another Function that function closed that Connection. So that where was the the Problem. By Commenting that part it worked.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I am collecting OS info using Win32_OperatingSystem(WMI).
its one property(InstallDate) which gives Installation Date of the OS, but datetime is in 20091117110355.375000+330 format. I want to convert this into actual DateTime format.
Thanks,
Sunil G.
|
|
|
|
|
Try this...
DateTime GetMeTheDateAndTime(string s)
{
return DateTime.ParseExact(s.Substring(0, 14), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvarientCulture);
}
...you may wan't to apply some validation thou
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
This works for sure, there may be something more compact:
string s="20091117110355.375000+330";
DateTime.ParseExact(s.Substring(0,14), "yyyyMMddHHmmss",null);
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hi,
There is also a .NET class to handle this conversion.
string dmtfDate = "20091117110355.375000+330";
DateTime dt = System.Management.ManagementDateTimeConverter.ToDateTime(dmtfDate);
Alan.
|
|
|
|
|
Hi ALL,
I am dynamically adding items to a combobox using a text box and a button. The value gets populated into the combobox, but when I close the form and reopen it, the combobox has no values in it.
Is there any way in which i can view the added item after closing and reopening the form.
Thanks,
|
|
|
|
|
You could create a static list which is also added to when you add to the comboBox, then use this list to populate the comboBox when the form is opened... FormShown event or something similar will do the trick
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
1???
What's wrong with my suggestion?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I tried to balance the negative feedback left.
|
|
|
|
|
Thanks
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I don't get the downvoting either.
Your suggestion is dead on. It would work just fine. No snarky answer and being helpful. You didn't deserve a 1.
|
|
|
|
|
Thanks for your support
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks for ur suggestion...
I tried to load the list as assigned it to the combobox at form load.
private List<String> List = new List<string>();<br />
private void button2_Click(object sender, EventArgs e)<br />
{<br />
comboBox.Items.Add(textBox4.Text);<br />
<br />
List.Add(textBox4.Text);<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
this.comboBox.Items.Add(List);<br />
}<br />
Am i doing it the right way??.... coz the combobox is empty again at form load..... I know am missing something.
Appreciate your response.....Thanks
modified on Wednesday, November 18, 2009 4:29 AM
|
|
|
|
|
You need to make the list static, this means that the list will be the same for all instances of the form. No matter how many forms you create, there will only be one list. This way the list will only be cleared when the application is closed, not when the form is closed.
Change to this line...
private static List<String> List = new List<string>();
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
okay Thanks for your reply.
I guess il have to create a table and populate the combobox from it.
DO you know how I can go about doing this using language integrated query?
Thanks,..
|
|
|
|
|
What do you mean by table? What's wrong with the static method? Are you trying to keep the list when the application is closed?
I don't use LINQ (still not been converted), its fairly simple to write code that will access data (with the use of other .Net functions of course) and you get full control of how it works that way. How are you wanting to store the data?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
hello....
Thanks for your reply. Yes it would be beneficial to keep the items list when the application is closed and reopened. By table I mean that, I would want to create a table with one column containing the list of items which the combobox should have. And I want to load this column as the combobox data source. Because I want the user to add new entries into the combobox as and when required.
|
|
|
|