Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > .NET Framework > .NET Parameterized Queries




Clound SSD Virtual Server

.NET Parameterized Queries

 
  .NET Parameterized Queries (Parameter Query) āļĢāļđāļ›āđāļšāļšāļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ€āļžāļ·āđˆāļ­āđ‚āļĒāļ™āļ„āđˆāļē Parameter āđƒāļŦāđ‰āļāļąāļš SQL Statement āđ€āļŦāļ•āļļāļœāļĨāļ—āļĩāđˆāđƒāļŠāđ‰āļžāļēāļĢāļēāļĄāļīāđ€āļ•āļ­āļĢāđŒ āļ—āļąāđ‰āļ‡āļ™āļĩāđ‰āļāđ‡āđ€āļžāļ·āđˆāļ­āļ•āđ‰āļ­āļ‡āļāļēāļĢāļ—āļĩāđˆāļˆāļ°āļ—āļģāļāļēāļĢāļāļģāļŦāļ™āļ”āļ„āļļāļ“āļŠāļĄāļšāļąāļ•āļīāđƒāļŦāđ‰āļāļąāļšāļ„āđˆāļēāļ•āļąāļ§āđāļ›āļĢ āļāđˆāļ­āļ™āļ—āļĩāđˆāļˆāļ°āļĄāļĩāļāļēāļĢ Input āļĨāļ‡āđƒāļ™ Statement āđāļĨāļ°āļ—āļąāđ‰āļ‡āļĒāļąāļ‡āļŠāļēāļĄāļēāļĢāļ–āļĨāļ”āļ›āļąāļāļŦāļēāļāļēāļĢāđāļšāđˆāļ‡āđāļĒāļāļĢāļ°āļŦāļ§āđˆāļēāļ‡āļ„āđˆāļē Argument āļ‚āļ­āļ‡āđāļ•āđˆāļĨāđˆāļ° Statement āđ€āļŠāđˆāļ™ Values ('1','I don't no')

Parameter Syntax
Dim QueryString As String = "SELECT * FROM Table1 WHERE Field1 LIKE @p1"
Dim Cmd As OleDbCommand = New OleDbCommand(QueryString, Connection)
Cmd.Parameters.Add("@p1", OleDbType.Char, 3).Value = "a"


āļŠāļģāļŦāļĢāļąāļšāđƒāļ™āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āļœāļĄāđ„āļ”āđ‰āļ­āļ­āļāđāļšāļšāđ„āļ§āđ‰āļŠāļģāļŦāļĢāļąāļš NameSpace 5 āļ•āļąāļ§āļ„āļĢāļąāļš


1.System.Data.OleDb - Parameter Query(OleDbParameter)
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
"VALUES (@sCustomerID,@sName,@sEmail,@sCountryCode,@sBudget,@sUsed)"

objCmd = New System.Data.OleDb.OleDbCommand(strSQL,objConn)

With objCmd
.Parameters.Add(New OleDbParameter("@sCustomerID","C005"))
.Parameters.Add(New OleDbParameter("@sName","Weerachai Nukitram"))
.Parameters.Add(New OleDbParameter("@sEmail","[email protected]"))
.Parameters.Add(New OleDbParameter("@sCountryCode","TH"))
.Parameters.Add(New OleDbParameter("@sBudget","2000000"))
.Parameters.Add(New OleDbParameter("@sUsed","1000000"))
End With



2.MySql.Data.MySQLClient - Parameter Query (MySQLParameter)
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
"VALUES (?sCustomerID,?sName,?sEmail,?sCountryCode,?sBudget,?sUsed)"

objCmd = New MySql.Data.MySQLClient.MySQLCommand(strSQL,objConn)

With objCmd
.Parameters.Add(new MySQLParameter("?sCustomerID", "C005"))
.Parameters.Add(new MySQLParameter("?sName", "Weerachai Nukitram"))
.Parameters.Add(new MySQLParameter("?sEmail", "[email protected]"))
.Parameters.Add(new MySQLParameter("?sCountryCode", "TH"))
.Parameters.Add(new MySQLParameter("?sBudget", "2000000"))
.Parameters.Add(new MySQLParameter("?sUsed", "100000"))
End With


3.System.Data.SqlClient - Parameter Query (SqlParameter)
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
"VALUES (@sCustomerID,@sName,@sEmail,@sCountryCode,@sBudget,@sUsed)"

objCmd = New System.Data.SqlClient.SqlCommand(strSQL,objConn)

With objCmd
.Parameters.Add(New SqlParameter("@sCustomerID","C005"))
.Parameters.Add(New SqlParameter("@sName","Weerachai Nukitram"))
.Parameters.Add(New SqlParameter("@sEmail","[email protected]"))
.Parameters.Add(New SqlParameter("@sCountryCode","TH"))
.Parameters.Add(New SqlParameter("@sBudget","2000000"))
.Parameters.Add(New SqlParameter("@sUsed","1000000"))
End With



4.System.Data.OracleClient - Parameter Query (OracleParameter)
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
"VALUES (:sCustomerID,:sName,:sEmail,:sCountryCode,:sBudget,:sUsed)"

objCmd = New System.Data.OracleClient.OracleCommand(strSQL,objConn)
With objCmd
.Parameters.Add(new OracleParameter(":sCustomerID", "C005"))
.Parameters.Add(new OracleParameter(":sName", "Weerachai Nukitram"))
.Parameters.Add(new OracleParameter(":sEmail", "[email protected]"))
.Parameters.Add(new OracleParameter(":sCountryCode", "TH"))
.Parameters.Add(new OracleParameter(":sBudget", "2000000"))
.Parameters.Add(new OracleParameter(":sUsed", "100000"))
End With



5.System.Data.Odbc - Parameter Query (OdbcParameter)
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
"VALUES (?,?,?,?,?,?)"

objCmd = New System.Data.Odbc.OdbcCommand(strSQL,objConn)
With objCmd
.Parameters.Add(New OdbcParameter("@sCustomerID","C005"))
.Parameters.Add(New OdbcParameter("@sName","Weerachai Nukitram"))
.Parameters.Add(New OdbcParameter("@sEmail","[email protected]"))
.Parameters.Add(New OdbcParameter("@sCountryCode","TH"))
.Parameters.Add(New OdbcParameter("@sBudget","2000000"))
.Parameters.Add(New OdbcParameter("@sUsed","1000000"))
End With



Transaction()









āļšāļ—āļ„āļ§āļēāļĄāļ­āļ·āđˆāļ™ āđ† āđ€āļāļĩāđˆāļĒāļ§āļāļąāļšāļāļēāļĢ āļāļēāļĢāđƒāļŠāđ‰ Parameter Query
Go to : ASP.NET Access BLOB Binary Data and Parameterized Query
Go to : ASP.NET MySQL BLOB Binary Data and Parameterized Query
Go to : ASP.NET SQL Server BLOB Binary Data and Parameterized Query
Go to : ASP.NET Oracle BLOB Binary Data and Parameterized Query


       
Bookmark.   
       

 

  By : TC Admin
  Score Rating : -
  Create Date : 2009-01-15 00:05:27
  Download : No files
     

Clound SSD Virtual Server
-->
Related Links
ASP.NET āđāļŠāļ”āļ‡āļĢāļđāļ›āļ āļēāļž Image āļšāļ™ Crystal Report āđāļšāļš Step by Step (VB.NET / C#)
ASP.NET āđāļŠāļ”āļ‡āļĢāļđāļ›āļ āļēāļž Image āļšāļ™ Crystal Report āđāļšāļš Step by Step (VB.NET / C#)
āļšāļ—āļ„āļ§āļēāļĄāļāļēāļĢāđāļŠāļ”āļ‡ Image āļĢāļđāļ›āļ āļēāļžāļšāļ™ Crystal Report āđ‚āļ”āļĒāđƒāļŠāđ‰āļāļēāļĢāļ”āļķāļ‡ Path āļĢāļđāļ›āļ āļēāļžāļ—āļĩāđˆāļ–āļđāļāļˆāļąāļ”āđ€āļāđ‡āļšāđ„āļ§āđ‰āļ—āļĩāđˆ SQL Server āđāļĨāļ°āļ­āđˆāļēāļ™āļĢāļđāļ›āļ āļēāļžāļ—āļĩāđˆāļ­āļĒāļđāđˆāđƒāļ™āđ‚āļŸāđ€āļ”āļ­āļĢāđŒ āđāļšāļš Binary
Rating :
Update :
2017-03-24 21:35:36 View : 35,113
DataGridView , ComboBox , ListBox : Basic in (.NET) Windows Forms Application
DataGridView , ComboBox , ListBox : Basic in (.NET) Windows Forms Application
Basic āļžāļ·āđ‰āļ™āļāļēāļ™āļāļēāļĢāļŠāļĢāđ‰āļēāļ‡ DataGridView , ComboBox , ListBox āļšāļ™ Windows Form āļ”āđ‰āļ§āļĒ Wizard āļ‚āļ­āļ‡ Visual Studio
Rating :
Update :
2017-03-24 21:18:46 View : 31,118
āļŠāļĢāđ‰āļēāļ‡ Sub Report (Subreport) āļšāļ™ Crystal Report āđāļšāļš Step by Step (VB.NET /C#)
āļŠāļĢāđ‰āļēāļ‡ Sub Report (Subreport) āļšāļ™ Crystal Report āđāļšāļš Step by Step (VB.NET /C#)
āļāļēāļĢāļŠāļĢāđ‰āļēāļ‡ Sub Report āļšāļ™ Crystal Report āđāļĨāļ°āļāļēāļĢ Link āļ‚āđ‰āļ­āļĄāļđāļĨāļĢāļ°āļŦāļ§āđˆāļēāļ‡ Main Report āļāļąāļš Sub Report āļĢāļ§āļĄāļ—āļąāđ‰āļ‡āļāļēāļĢ Set DataSource āđƒāļŦāđ‰āļāļąāļš Sub Report
Rating :
Update :
2017-03-24 21:34:46 View : 55,013
.NET Smart Device  āđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāļšāļ™ Smartphone, Pocket PC , Windows CE , Window  Mobile 5-6, Hand Held,...
.NET Smart Device āđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāļšāļ™ Smartphone, Pocket PC , Windows CE , Window Mobile 5-6, Hand Held,...
.NET Smart Device Project āđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāļšāļ™ Smartphone, Pocket PC , Windows CE , Window Mobile 5-6, Hand Held,...
Rating :
Update :
2017-03-24 21:17:48 View : 41,902
VB.NET/C# MySQL (ADO.NET) āļžāļ·āđ‰āļ™āļāļēāļ™āļāļēāļĢ āđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ ADO.NET āđ€āļŠāļ·āđˆāļ­āļĄāļ•āđˆāļ­āļāļąāļšāļāļēāļ™āļ‚āđ‰āļ­āļĄāļđāļĨ MySQL
VB.NET/C# MySQL (ADO.NET) āļžāļ·āđ‰āļ™āļāļēāļ™āļāļēāļĢ āđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ ADO.NET āđ€āļŠāļ·āđˆāļ­āļĄāļ•āđˆāļ­āļāļąāļšāļāļēāļ™āļ‚āđ‰āļ­āļĄāļđāļĨ MySQL
āļšāļ—āļ„āļ§āļēāļĄāđƒāļŠāđ‰ ADO.NET āđ€āļŠāļ·āđˆāļ­āļĄāļ•āđˆāļ­āļāļąāļšāļāļēāļ™āļ‚āđ‰āļ­āļĄāļđāļĨ MySQL āđāļšāļšāļ‡āđˆāļēāļĒ āđ† āļĄāļĩāļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡āļ—āļąāđ‰āļ‡ VB.NET āđāļĨāļ° C#
Rating :
Update :
2017-03-24 21:27:18 View : 64,752
VB.NET/C# Connect to SQL Server Using ADO.NET āļžāļ·āđ‰āļ™āļāļēāļ™āļāļąāļš SQL Server and ADO.NET
VB.NET/C# Connect to SQL Server Using ADO.NET āļžāļ·āđ‰āļ™āļāļēāļ™āļāļąāļš SQL Server and ADO.NET
SQL Server āđ€āļŠāļ·āđˆāļ­āļĄāļ•āļīāļ”āļ•āđˆāļ­āļœāđˆāļēāļ™ ADO.NET āđ€āļžāļ·āđˆāļ­āđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāļ”āđ‰āļ§āļĒāļ āļēāļĐāļē VB.NET āđāļĨāļ° C#
Rating :
Update :
2017-03-24 21:30:04 View : 62,713
ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

āļŠāļ­āļ™ PHP āļœāđˆāļēāļ™ Youtube āļŸāļĢāļĩ
āļŠāļ­āļ™ Android āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ Android
āļŠāļ­āļ™ Windows Phone āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ Windows Phone 7 āđāļĨāļ° 8
āļŠāļ­āļ™ iOS āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ iPhone, iPad
āļŠāļ­āļ™ Java āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ āļ āļēāļĐāļē Java
āļŠāļ­āļ™ Java GUI āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ āļ āļēāļĐāļē Java GUI
āļŠāļ­āļ™ JSP āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ āļ āļēāļĐāļē Java
āļŠāļ­āļ™ jQuery āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ āļ āļēāļĐāļē jQuery
āļŠāļ­āļ™ .Net āļāļēāļĢāđ€āļ‚āļĩāļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ āļ āļēāļĐāļē .Net
Free Tutorial
āļŠāļ­āļ™ Google Maps Api
āļŠāļ­āļ™ Windows Service
āļŠāļ­āļ™ Entity Framework
āļŠāļ­āļ™ Android
āļŠāļ­āļ™ Java āđ€āļ‚āļĩāļĒāļ™ Java
Java GUI Swing
āļŠāļ­āļ™ JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
āļŠāļ­āļ™ jQuery
āļŠāļ­āļ™ jQuery āļāļąāļš Ajax
āļŠāļ­āļ™ PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
āļŠāļ­āļ™ SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
āđāļ™āļ§āļ—āļēāļ‡āļāļēāļĢāļ—āļģ SEO
āļ›āļĢāļąāļšāđāļ•āđˆāļ‡āđ€āļ§āđ‡āļšāđƒāļŦāđ‰āđ‚āļŦāļĨāļ”āđ€āļĢāđ‡āļ§


Hit Link
   







Load balance : Server 02
Inline