Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Should we escape ' when building command text?
Message
From
31/12/2007 15:50:39
 
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
ASP.NET
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01278630
Message ID:
01278739
Views:
31
This message has been marked as a message which has helped to the initial question of the thread.
OK, so it sounds like the data is all the same (so you can use the same parameters), except for the dates are different in each insert. So, use the parameters for everything except the dates. Embed the dates as you are currently doing.

~~Bonnie


>>OK, I see. Do you *have* to do it that way? (I'd execute a separate insert for each one). If you *do* have to do it that way, would the various Insert statements be using different parameter names set to different TextBox fields? If so, you could still do it the way I mentioned.
>>
>
>Also, only the dates are different. I'm not sure why do we need to insert the same information multiple times, I'm not yet familiar with the database structure.
>
>>Oh, and one more thing .... since you're building this Insert command string from TextBox values, this means that you're not separating out your UI from your DataAccess. Are you aware that this is bad practice? If you DataBind your TextBox controls to either a DataSet or some other business object, you could pass the DataSet (or biz object) back to your DataAccess classes and not have all that code in your UI (where it *should not* be!!)
>>
>>~~Bonnie
>>
>
>Hi Bonnie,
>
>This is not my code. It is complex web-site (for me, at least, at the moment). For now I need to fix a simple problem, that the recurring event is not saved correctly in the database. I'm just working with the existing code slowly trying to understand it. The code simply tries to create a long insert command to create records with future dates. It doesn't take into account Holidays, as I see.
>
>Also perhaps it should be a SP instead, I think. The User interface and code seem to intermix in this particular page.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform