|
Hi,
I have an application in C#.Net.
This application uses a DSO ActiveX Framer control to load the MS Office applications.
I am loading an excel document here.The loading of the excel comes with default 3 sheets.
I enter some data in Sheet1.
And now i got to the Sheet2 and right click on the tab and click 'Insert' and insert a chart.
Now after selecting the option 'Select Data' from sheet2, i click on Sheet1 to select the Chart data range for the box 'Select Data Source'.
Now when i click on the Sheet1, my application hangs and in order to proceed i have to kill my application from the Task manager.
This does not happen with MSOffice 2003 but only with Office 2007.
My application does not directly get any click events of the Excel. There is a timer and we get this timer tick event.
Could any one help me out in this?
|
|
|
|
|
Hi,
Can any one help to develop a method in C#, so that i can use that statement to INSERT - UPDATE - DELETE operations upon Database.
I'd achieved this in JAVA but couldn't C#
|
|
|
|
|
.Net provides namespaces like System.Data.OleDb and System.Data.SqlClient . These have a lot classes that will help doing these operations. Look into them. If you get stuck somewhere while trying, post the query. There are plenty of members here to help.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Try the following...
<pre> public int ExecuteNonQuery(string strConnectionString
, string strStoredProcedure
, SqlParameter[] ObjSQLParameter)
{
// declare variables
SqlConnection ObjSqlConnection;
SqlCommand ObjSqlCommand;
int intRowsAffected = -1;
try
{
// prepare a connection
ObjSqlConnection = new SqlConnection(strConnectionString);
// open connection
ObjSqlConnection.Open();
// prepare command
ObjSqlCommand = new SqlCommand(strStoredProcedure, ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
// asign parameters to command
//SqlParameter collObj ;
foreach (SqlParameter collObj in ObjSQLParameter)
{
ObjSqlCommand.Parameters.Add(collObj);
}
// execute command
intRowsAffected = ObjSqlCommand.ExecuteNonQuery();
}
catch ()
{
intRowsAffected = 0;
}
finally
{
ObjSqlCommand.Dispose();
ObjSqlConnection.Close();
ObjSqlConnection.Dispose();
}
// return affected rows
return intRowsAffected;
}
</pre>
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Ew:
catch ()
{
intRowsAffected = 0;
}
is a very bad idea; just allow the Exception to be thrown.
And why not use using statements for the command and connection?
|
|
|
|
|
I agree...it's happened due to modifying the code snippets.. Thanks
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
|
Hi,
I have an app that gets data out of the database. This data is updated via a separate application. At the moment the first application has to check every x seconds if there is any new data. I seem to remember reading a while ago something about subscribing to data changes or something so that instead of it being a pull from sql server, sql server actually notifies the app that there is new data and then the app can go get it, and therefore doesn't have to check itself.
Is that right, or did I dream that?
Cheers,
Rob
|
|
|
|
|
I guess you are looking for SqlDependency or SqlNotificationRequest class.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Ahhh, that may well be it, thank you very much!
|
|
|
|
|
I agree...But i think using a trigger would be a good idea to keep track any alternation / insertion of data.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
And how would that send notification to front end?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
so many ways you can do this... But I think your suggestion is excellent regarding this issue.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
i want to read text of buttons or lables of swf
which is running inside the shockwaveflash control.
Thanks,
zahid
|
|
|
|
|
|
|
With code.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Suppose I have a byte from USB device which holds the day of the week (1 to 7)
I need to print out Sunday to Saturday based on values 1 to 7. I MCU I create a look up table of strings or string array in ROM and access with index.
What is the method here. I think it is enum. But from tutorials I cant figure out how to get a string from a number like indexing.
Please suggest best way here.
Thanks
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
Hi,
yes enum is fine since the strings you want are valid identifiers, hence:
enum Days {
Monday=1,
Tuesday=2,
...
}
public void Test() {
for (int i=1; i<8; i++) Console.WriteLine(((Days)i).ToString());
}
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
There are several ways (here are two):
string[] weekdays = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
...
string day = weekdays[3]; or
enum Weekday
{
Sunday = 0,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
};
...
string day = ((Weekday) 3).ToString();
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks a lot to all.
I got it. One clarification.
string[] weekdays = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
...
string day = weekdays[3];
If I use this method, is it creating a RAM string array? or is this array in ROM only? unlike a variable string?
I am using enum .
Thanks a lot
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
Depends on your compiler. For Visual Studio, it will always be a RAM string, because it won't let you prefix it with "const" because it is a reference type and it (understandably) won't let you initialize const reference types other than string. Despite it being an array of strings. Grrr.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
CelestialCoder wrote: or is this array in ROM only?
on a PC the file system probably resides on a disk, and anything you load from disk is located in RAM; the only thing in ROM (or EEPROM) probably is the BIOS code.
However literal strings belong in code space, not data space. Code space could be write-protected at run-time.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Got it. Thanks for all the info.
Regards
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|