Chris Peacock's Q&A profile
SQL Server SQL Injection prevention
I am building my first ASP.Net app from scratch and while working on the DAL I came across the problem of SQL Injection. I searched on the web and read different articles but I am still unsure about the answer. My question is should I add db.AddInParameter(dbCommand, "AvatarImageID" , DbType .Int32, avatarImageID); Add in Parameters to my C# code to avoid SQL Injection. What is the best practice. I am unclear if the stored procedure already helps me avoid SQl Injection or if I need the add in parameters in the C# methods to make it work. I need some help. Thanks, Newbie My C# update method in the DAL (still working on the code) private static bool Update( AvatarImageInfo avatarImage) { ...Show All
SQL Server SPLIT AN ARRAY!
dear friends, I have a stored procedure that receives a parameter like ' 123#67#1#89#52#' I need to insert each number (123, 67, 1...) in a table... How can I do it using the best performance Thanks!!! Cheers!!! Jean, But I need is to extract each field in a while, and insert each extracted value in one table. The example you gave me is not too long for my case Thanks!! ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Creating/Destroying an object.
So, I was working on a new update to my game, when I realized that I have no idea how to create or destroy an object outside of the beggining of the game. I've been looking through tutorials, but so far I haven't found anything useful. Can anyone tell me how to do this, or link me to a tutorial on the subject I'd be most grateful. :D I've rarely seen an instance where you need to force the GC to do a collection. And for something like powerups, it's doubtful that you'd have so many of them that you'd need to force it. ...Show All
Windows Live Developer Forums How to show the pop up on click of push pin?
Hi, I am using custom pushpins in my VEMap. Also i am able to get the custom pop up on mouse over. But my requirement is to show the pop up only on click of the push pin. I don't want to show the pop up on mouse over or on call back event. Can anyone please help me to overcome my problem Hi John, Thanks for your great help!! I modified the function as pasted below: function EventHandlerOnClick(e) { VEPushpin.ShowDetailOnMouseOver = true; if (e!=null) { document.getElementById(e.currentTarget.id + "_" + map.GUID).onmouseover(); VEPushpin.ShowDetailOnMouseOver = false; } else { document.getElementById(window.event.srcElement.id).onmouseover(); VEPushpin.ShowD ...Show All
Visual Studio Express Editions Windows Classic themes
In many applications, the style looks like the old Windows Classic theme, even when run under Windows XP. How can I do this in my application Is it possible Thanks, James. Hi, Vampire Using Microsoft Windows XP, you can define the visual style or appearance of controls and windows from simple colors to textures and shapes. You can control each defined part of a control as well as each part of the non-client (frame and caption) area of a window. The user can then use the Appearance tab in the Windows Control Panel to switch between the classic visual style and other available styles. A visual style is included with the Windows XP release. Using helper libraries and application programming inter ...Show All
Visual C++ Hosting WinForms controls in an ATL window
Hi folks, I'm trying to host a ToolStrip control in CAxDialog (yes, I realize it's not officially supported), and strangely enough, found two ways of doing it. The first one is to simply create the ToolStrip, get its handle and SetParent() it to the dialog. The second is to go the more "proper" way: create a dummy CAxWindow and call AtlAxAttachControl on it. The question is, what is the difference The ToolStrip seems to be behaving normally in both cases, so what is the advantage of choosing the second option Also, is there anything else that needs to be done to host the control properly Cheers, Alex. ...Show All
SQL Server Parent Package Doesn't Recognize Child Settings
I have two issues: I have a simple parent that uses an Execute Package Task to call a simple child package. The child package has a Data Flow that I disabled. When running the child package by itself, the data flow task is bypassed. When running the package via the parent the data flow task executes. Second issue is when you disable the package configurations in the child, the parent doesn't recognize that it's diables and tries to load the configurations. It's almost like there are some settings in a child that get ignored by the parent Anyone else experience this thx ...Show All
Visual Basic How can I simply the following code?
Hello, How can I simplify the working code below trimLogin = My .User.Name.ToUpper.ToString() userName = trimLogin.Substring(9) intCommentTab = 0 Do Until myReader.Read = False tblUserInitials = myReader( "UserInitials" ) intCommentTab = myReader( "UserCommentTab" ) If userName = myReader( "UserLoginID" ) Then Dim strTab1 As String Dim strTab2 As String Dim strTab3 As String Dim strTab4 As String Dim strTab5 As String Dim strTab6 As String Dim strTab7 As String Dim strTab8 As String Dim strTab9 As String Dim strTab10 As String strTab1 = pagMgr1.Name.Trim.Substring(6) strTab2 = ...Show All
Microsoft ISV Community Center Forums Help with a formula
I need to write a formula for Excel that calculates the amount of fuel that is in a tank. Here is what it is for. We have cylinder tanks that lay horizontaly. Each month we put a dipstick into the tank to measure how many inches of fuel is left in the tank. I need a formula that will take that and calculate it into gallons. Here is the formula I have to work with. / -1 r - h \ V = L * | [ r^2 * cos (--------)] - [sqrt(2rh - h^2) * (r - h)] | \ r / Any Help is appreciated (BTW I am not the best at math so if possible an explination of this formula would be greatly appreciated) Ok another probl ...Show All
Visual Basic Reflection fails with File Not found.
Hello All: What's happening; A Net2.0 application loads a custom control using reflection. When the control is actually shown in the interface, the control instantiates another control from the same assembly into another panel of the interface. The User control that is initially instantiated through reflection and is show in the left panel we cal the "SelectControl" and the second user control that is ionstantiated by the "SelectControl" and placed in the Right Panel is called the "ViewControl" It's a plug-in mechanism we are using. There are already several plugin controls we have built that are used this way in this application that work without issues. so the Architectual model and the code implimenta ...Show All
Visual C# only one row is "read" using dataReader
I'm trying to populate a dataTable using a dataReader... how can i do this i'm stuck getting only the first row. what i want it to do is get all the rows that pertain to a codeno. For example in my oracle database/table i have 5 rows with the codeno '1'. it should get all of this rows and populate the columns of my dataTable. hope someone answers... Some type of DataAdapter should be used to fill DataTable. It's not common to use DataReader for that. If you want to read all rows from result you need to loop all of them with while(yourReader.Read()) { ..... } ...Show All
Visual Studio 2008 (Pre-release) Bound data displaying performance issue
When trying to display a DataTable from the DataSet using ListView/GridView (GridView is generated dynamically and has the same columns as the DataTable) the application is really very slow. DataTable has more than 15 columns and about 15000 rows. I made similar application using WinForms and it is much more faster. WPF promises better performance but it seems to be different. I have tried to define GridColumnDefinitions in XAML instead of doing it at runtime but it did not help. Use of VirtualizingStackPanel.IsVirtualizing="True" hangs the application. How can I fix this issue Thanks in advance. UI Virtualization generally solves this "issue"... According to what you say, the ...Show All
Smart Device Development UPnP: problem with QueryStateVariable
Hello! I have a problem with the UPnP API on Windows Mobile 5.0 Pocket PC Emulator (Microsoft Visual Studio 2005)... My software is able to find devices and invoke their actions but some things don't work: 1) InvokeAction of an action with one (or more) output parameter: it returns an array with one (or more) elements but the type of these (VARIANT) element is VT_ERROR. 2) Same happens if I use QueryStateVariable (returned VARIANT has type VT_ERROR). void CMyProject::QueryStatusVariable(IUPnPService *pUPnPService, CString VariableName) { HRESULT hr=S_OK; TCHAR tszMessage[2048]; CString strVariable; BSTR bstrVariableName = NULL; bstrVariableName=VariableName.AllocSysString(); if (bstrVariableName! ...Show All
Visual Studio Express Editions How do I hide a form?
I am looking to create a simple program that pops up a balloon on startup. What I want to do is hide the form1 that is created. How do I do it I can use the notifyicon for displaying the balloon no problem. You may have to take a few extra steps, since just 'hiding' the form may cause it to flicker: Set the opacity to zero, so it's completely transparent (and perhaps set showintaskbar false). ...Show All
Visual Studio Express Editions sorting custom collections
this page has a good overview of how to sort collections using IComparer http://tim-price.net/blog/articles/171.aspx what i would like to do is sort by 2 properties, in other words, by LastName AND firstname. obviously the firstname sort has to be in context of the Lastname sort. how is this done thanks ;-) Take a look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=539460&SiteID=1 Just change the compare function to compare the names first. If they are the same, then return the comparison of the lastnames, otherwise return the comparison of the first names. Hope this helps, ...Show All
