Peter Peng's Q&A profile
.NET Development Updating nulls in sqlserve datetime column
How do we update nulls for a datetime column The following is the code I am using, its throwing an exception = "String was not recognized as a valid datetime". string sEffDate1 = effectiveDt; string sEffDate2 = ""; int iResult; iResult = sEffDate1.CompareTo(sEffDate2); if (iResult <= 0) { param = new SqlParameter("@effectiveDt",SqlDbType.DateTime,8); param.Value = DBNull.Value; cmd.Parameters.Add(param); } else { param = new SqlParameter("@effectiveDt",SqlDbType.DateTime,8); param.Value = Convert.ToDateTime(effectiveDt); cmd.Parameters.Add(param); } Thank you, Yog Dear Yog, You sh ...Show All
Visual Basic Embedded Objects/Saving From Clipboard
I'm able to copy an embedded object, specifically in Word, to the clipboard. I can even see the various types of data stored in the clipboard. My problem is getting to the object or package contents. I want to mimick the following: Select an object by clicking once on it. Copy to clipboard Paste to folder location. I've got it through #2, but #3 has got me stumped. I don't have all the code I've tried, but I could put the latest on here if necessary. Using VB.NET if that helps. Thanks for the help. Tried that at first. This gives me "Object reference not set to an instance of an object" Any other ideas. Started looking at COleDataObject Class , but I can't find ...Show All
SQL Server Couple of questions over SSRS over SSAS
I've created a sales analysis cube using SQL Server 2005 and want to do some reporting using SSRS. My problems are as follow: 1. How can I change the report parameter from a Date type into a member of the Date dimension I need to do this because it's easier for business user to select the date and I can set a sensible default to it. 2. How can I create a hourly sales analysis report for all branches If I add a chart into SSRS, I will get all shop data summing up right now into a single chart. Instead, I would like to have a chart for each branch. My business user will not accept to manually select different branch and generate the required chart. 3. How can I add a percentage to the corresponding value My business user may want to view the ...Show All
Visual Studio Express Editions Viewing a splashscreen before viewing the form of an application
I'm working on an application, a webbrowser. I followed the documentation in the book "Build a program now! Visual C# 2005 express edition", Chapter 6. The problem is that the splashscreen is viewed, but in the background you can see a part of the form, that should be visible afted the splashscreen dissapeares. I created a splashscreen. In the constructor of the form of my browser I wrote the following code: Splash splashScreen = new Splash (); public Browser() { InitializeComponent(); splashScreen.Show(); Application .DoEvents(); } When the form is finished loading it throws an "Activated" event. I catch this event with the following method: private void Browser_Activated( ...Show All
SQL Server How to set up a login that should execute a specific SQL Server Agent job
I am looking for a good idea or best practice for setting up a security plan which allows users to execute a specific job, owned by the SQL Server Agent Service Account. I tried to use the msdb SQLAgentOperatorRole, but unfortunately I recognized, that every local job could be executed. I would like to have only one job executed by the user and all others should be visible, but not executable. What is the best practice for this request Can Proxies and credentials be helpful and if yes, how do I have to use them In other words: what is the best approach for this request (end user should see and start specific jobs in the SQL Server Agent). Thanks in advance Norbert ...Show All
Visual C# How can I create an empty XmlElementString with XmlWriter
I am trying to dump out a collection of values from an editor I am writing. There are some elements that I need to write out, even though they are empty. Whenever I try something like... writer.WriteElementString( "variable" , "" ); or writer.WriteElementString( "variable" , string .Empty); I get <variable /> instead of <variable></variable> I tried a WriteStartElement("variable") followed by a WriteEndElement but that gave me... <variable> </variable> Does the line separation make any difference to having it all on one line i can see you already have that in the code and it should work tw.WriteStartElement( "variable", String.EMpty ); ...Show All
Windows Forms dataGridView issue
i am using c#.net 2005. on my form, i have a databound dataGridView component for displaying patient list, the first column is "patient_id". when i click on a button, i want to find out the patient_id of selected row. please help the datagridview has a property called selectedRows. This means you can get a collection of rows that have been selected by the user and iterate through them and go through the first column and get the value. Example: foreach(DataGridViewRow currentRow in this.theDataGridView.SelectedRows) { MessageBox.Show(currentRow.Cells["patient_id"].Value.ToString()); } does this help ...Show All
.NET Development Update Program
Can someone point me in the right direction (tutorial) on having way to update your program I'm guessing your gonna have to open a socket to a url and check the file contents compared to the one that is currently running. If they are equal then ignore it otherwise download and restart the app. Any help would be greatly appreciated. Thanks Apparently Click Once does this for you. It has all the necessary plumbing to check the versions etc. Otherwise, yes you have to have some URL where the program checks, compares the version, informs the user, downloads the newer version, does an in place update, etc. ...Show All
SQL Server Oracle query does not work in SSIS
Hello All, I am trying to run the below query in SSIS, However it does not work, but when I try to run the same query in Oracle client it works fine. Here is the following query: select 'AAA-'||OWNER AS SOURCE, table_name, column_name, SUBSTR(data_type,1,50) DATA_TYPE , SUBSTR(decode(data_type,'NUMBER', DATA_PRECISION, DATA_LENGTH),1,20) DATA_LENGTH from all_tab_cols where owner='XXX' ORDER BY TABLE_NAME, COLUMN_ID Here ARE the following errorS I get when running from SSIS: [ORA_AAA_XXX [147]] Error: There was an error with output column "SOURCE" (612) on output "OLE DB Source Output" (157). The column status returned was: "The value could not be converted because of a potential loss of data.". ...Show All
.NET Development digital certificate web request
I am trying to automate a process in which we access a web site with a digital certificate and login/password. A web form is filled out and then submitted. I want to do a web request (POST) to submit the information, but do not know how to use the digital certificate and login/password authentication in code. Anyone have experience with something similar Thanks System.Net supports Client certificates and auth. the way to do this is Request.ClientCertificates ==> Add your certifcicates Request.Credentials = new NetworkCredential("user", "pass", "domain") ...Show All
Visual Studio 2008 (Pre-release) A TCP error (10049: The requested address is not valid in its context)
Hello, When I try to listen and use my computer's external ip I get the error "A TCP error (10049: The requested address is not valid in its context) occurred while listening on IP Endpoint=218.166.32.38:808. Here is the code: ServiceHost sh = new ServiceHost ( typeof ( MathService )); sh.AddServiceEndpoint( typeof ( IMath ), //contract type new NetTcpBinding() , //one of the built-in bindings "net.tcp://218.166.32.38/MathService/Ep1" ); //the endpoint's address //create and open the service runtime sh.Open(); System. Console .ReadLine(); What are the valid IP addresses on the local computer (run ipconfig /all). If your IP address isn't on this list then your addres ...Show All
Visual Studio Team System Turning a Work Item Query Into a Report
My goal is to be able to display on the project web page a list of the current work items in progress and their status. I have several Work Item Queries which are great - they break down the different work items by area and stakeholder (customized the work item) and priority. But they are only usable from within Team Explorer - so it isn't good for pulling up at someone else's desk or at a public terminal outside the office. Is there a way to convert them into reports (and then into web reports) without re-implementing the entire query Alternatively, I've tried to design a report using the report designer, but the cube doesn't correspond to the one in the tutorial video I'm watching, and so I can't even get the list of the work items ...Show All
Visual C++ Need info regarding how to print unicode characters using VC++
Hi, I need info regarding how to print unicode characters using VC++ Regards, Nishant Sharma For those that are concerned, this question is also in the VC Language forum at Need info regarding how to print unicode characters using VC++ . ...Show All
Visual Basic Regular Expression
4/21/2003 : On 4/21/2003 6:02:49 PM By DBROWN :: ; On 4/21/2003 7:04:41 PM By DBROWN :: called on 4/19 ; from the above string can any one tell me the pattern to extract the date preceded by 'On ' and name preceded by 'By' ...Show All
Smart Device Development Problems with ADO.net Execute statements
I've been having a problem with execute statements where I receive an InvalidOperationException with the message "Application-defined or object-defined error". I have a mechanism I use to automatically retry executions if I get an SqlException that is not a problem with my SQL. I have this problem with ExecuteReader and ExecuteNonQuery, though I suspect that I would get it for ExecuteScalar and ExecuteXmlReader if I used them. Here is my code: Public Function ExecuteReader(ByVal qryTemp As SqlClient.SqlCommand) As SqlClient.SqlDataReader Dim rsTemp As SqlClient.SqlDataReader Dim i As Integer Dim bolSQL As Boolean Dim e As Integer Try e = 0 rsTemp = Nothing e = 1 bolSQL = False ...Show All
