DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 29 Jul 2007 12:31:14 +0100,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    Ganesh
          2    Jesse Houwing
          3    William Vaughn


what's the best approach to follow for sql execute   
Hi There,

What's the better way to follow when we use sql
string sql = "Inset into table(f1,f2) values (@f1, @f2)";

then add and passing parameters or in the first place itselef assign the 
values to the string
string sql = "Inset into table(f1,f2) values (" + tbName.text + ", " + 
tbCity.Text  +");";

Thanks

Ganesh
Date:Sun, 29 Jul 2007 12:31:14 +0100   Author:  

Re: what's the best approach to follow for sql execute   
* Ganesh wrote, On 29-7-2007 13:31:

> Hi There,
> 
> What's the better way to follow when we use sql
> string sql = "Inset into table(f1,f2) values (@f1, @f2)";
> 
> then add and passing parameters or in the first place itselef assign the 
> values to the string
> string sql = "Inset into table(f1,f2) values (" + tbName.text + ", " + 
> tbCity.Text  +");";



add and passing parameters is the only way to go. You'll be vulnerable 
to all kinds of security issues otherwise. (read up on SQL Injection).

Jesse
Date:Sun, 29 Jul 2007 13:45:40 +0200   Author:  

Re: what's the best approach to follow for sql execute   
The best approach is to use parameters--unless you're adding a lot of rows. 
In this case SqlBulkCopy is far better.

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Ganesh"  wrote in message 
news:uAmk7Pd0HHA.5772@TK2MSFTNGP02.phx.gbl...

> Hi There,
>
> What's the better way to follow when we use sql
> string sql = "Inset into table(f1,f2) values (@f1, @f2)";
>
> then add and passing parameters or in the first place itselef assign the 
> values to the string
> string sql = "Inset into table(f1,f2) values (" + tbName.text + ", " + 
> tbCity.Text  +");";
>
> Thanks
>
> Ganesh
>
>
>
>
> 
Date:Mon, 30 Jul 2007 09:05:50 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us