|
try
{
using(OracleConnection con = new OracleConnection())
{
con.ConnectionString = "User Id=scb;Password=scb;Data Source=137;"
con.Open();
.
..
conn.close();
}
}
catch(Exception e)
{
}
finally
{
con.Close();
OracleConnection.ClearPool(con);
con.Dispose();
}
|
|
|
|
|
Does anyone know how to actually 'start' a windows service as part of the install (.msi)?
I have a windows service and created an installer for it and it installs fine, but it would be really great if the installer could just start the service after installation complete.
Thanks.
R.Bischoff
Tengas un buen dia
|
|
|
|
|
I haven't done that in quite a long time. IIRC, you had to override the Commit method in your installer class and use the ServiceController class to start the service.
Sorry, I don't have an example. It's been about 5 years since I had to do that.
|
|
|
|
|
That's close to what I thought I had to do, but wasn't sure. I thought I had to do that via 'Custom Action', but I'll try to just add it in the installer first.
Thanks.
R.Bischoff
Tengas un buen dia
|
|
|
|
|
Sure, require a reboot.
|
|
|
|
|
Obviously, right
Well, sometimes people don't want a server being rebooted, so thats not an option.
R.Bischoff
Tengas un buen dia
|
|
|
|
|
I found an article about capturing the output from a console application
http://www.codeproject.com/KB/cs/ProcessStartDemo.aspx
How do I do the same with a windows application?
I need to capture some text from a certain window in an application. Actually it is the text highlighted that I want.
How do I do that?
|
|
|
|
|
Axell wrote: How do I do the same with a windows application?
You can't do it the same way at all. The technologies and techniques are so different that the article you read is completely useless to you.
Well, VERY SIMPLISTICALLY, you have to get the window handle of the target window you want and then send that window a WM_GETTEXT message, then get the string pointed to by the returned pointer. But! There's nothing that say that every textbox or control has to respond to the WM_GETTEXT message, so there's no way to guarantee this is going to work at all for every control!
WARNING! This technique requires an in-depth knowledge of how Window's windowing system works. If you don't know this, you're going to have an extremely difficult time pulling this off.
|
|
|
|
|
Screen capture and OCR?
|
|
|
|
|
5 for that.
Simon
|
|
|
|
|
I have the following VB.net codes:
<br />
da = New OleDbDataAdapter(strSQL, dbConn)<br />
dt = New DataTable<br />
da.Fill(dt)<br />
<br />
Dim rows As DataRow<br />
cnt = dt.Rows.Count()<br />
<br />
If cnt > 0 Then<br />
For Each rows In dt.Rows<br />
Total += rows.Item("Total")<br />
Next<br />
End If<br />
I changed to these C#:
<br />
da = new OleDbDataAdapter(strSQL, CGlobal.dbConn);<br />
dt = new DataTable();<br />
da.Fill(dt);<br />
<br />
cnt = dt.Rows.Count;<br />
<br />
DataRow rows = default(DataRow); <br />
<br />
if (cnt > 0)<br />
{<br />
foreach (rows in dt.Rows) <br />
Total += rows.Item("Total"); <br />
}<br />
And I have the error in in above, can anyone help to correct my C#?
Thank
|
|
|
|
|
When you use a foreach, you need to say what the type is; hence foreach (DataRow rows in dt.Rows) .
|
|
|
|
|
I did try before & had 2 errors:
<br />
cnt = dt.Rows.Count;<br />
DataRow rows = default(DataRow); <br />
<br />
foreach (DataRow rows in dt.Rows)<br />
Total += rows.Item("Total"); <br />
By any chance you know how to fix them? What I need to get values from column 'Total' of those selected row
Thanks
|
|
|
|
|
rows is already defined in the line above the foreach.
Why not use row seing as it will represent just one row.
foreach (DataRow row in dt.Rows)
Total += row.Item("Total");
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I did try & have small error from Item, but I think I can fix it by using array for the column.
Thanks,
|
|
|
|
|
Item is an indexed property, so you use
Total += rows.Item["Total"]; C# uses square brackets [ and ] for indexers.
|
|
|
|
|
ATC wrote: have the error in in above
Be more descriptive
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
da = new OleDbDataAdapter(strSQL, dbConn);
dt = new DataTable();
da.Fill(dt);
DataRow rows = null;
cnt = dt.Rows.Count();
if (cnt > 0)
{
foreach (DataRow rowsWithinLoop in dt.Rows)
{
rows = rowsWithinLoop;
Total += rowsWithinLoop["Total"];
}
}
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
Hello all,
In the solution i am working there are more than 1000 forms and we are planning to enhance all forms' Layouts to support localization, like resizing labels and moving associated controls using TableLayout panel control. Doing manually is tedious and time consuming process.
Any thoughts of how to enhance UI layout to use TableLayout programmatically? (I guess Programmatically little difficult to decide how may rows or columns to create? which controls to be spanned?
Any ideas?)
Thanks
|
|
|
|
|
Member 2324483 wrote: we are planning to enhance all forms' Layouts to support localization,
Shouldn't that have been a basic requirement at the start of this app??
Member 2324483 wrote: Any thoughts of how to enhance UI layout to use TableLayout programmatically?
Have fun with that. You might be able to do it in code, but not easily. It'll require some kind of analysis engine to determine the converted layout. And, as with any automated conversion process, there's going to be things the engine just can't figure out properly. Form layout's are going to get trashed one way or another.
I don't know the size of your team, but it better be big, because either way, you've got a near total rewrite of your UI on your hands and LOTS of testing to do.
|
|
|
|
|
thanks for the reply.
I agree with you that it should be a basic requirement. But the solution, which i am working on, is upgraded from VS 2003 to 2005 to 2008. so, no tablelayoutpanel in 2003. Now planning to localize the app.
|
|
|
|
|
I hope you get paid by the hour!
|
|
|
|
|
|
Nope. There's just no easy way to do this. You've got about a thousand forms to go through. Even if you had an automated way to do it, you'd still be going through a thousand forms to check the automated processes work.
|
|
|
|
|
I have a Reference Question. I am faily new to C# so this might be a very basic question. I have my references folder in my project. I can add and delete them as needed. But I am trying to add two references that have the same name but different version numbers. But I need both because the both do something different for me. Is there a way to add a reference that is the same name and type but a different version number?
What I am trying to do is connect to a COM server. The Reference is to the COM type library so that I can access it and get all of the data out of it. The problem being is I am supposed to support two versions of the same server. When I try to add the reference it states that the type library already exists. When I add the reference I add it from the location on my C drive and it adds it to my project. Is there a way not to add it to my project, but point to it with a path and take whatever reference I need whenever I need it and not have it part of my project?
|
|
|
|