|
![](/images/resource/spacer.gif) |
|
sql injection c# asp.net วิธีนี้ป้องกันได้ไหมครับ ช่วยแนะนำทีครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
sql injection c# asp.net
วิธีป้องกัน sql injection ผมเขียนแบบนี้ป้องกันได้ไหมครับ รบกวนชี้แนวทางด้วยนะครับ ขอบคุณครับ
public class dbcon
{
public string constring()
{
return ConfigurationManager.ConnectionStrings["dbrubber_plant"].ConnectionString;
}
public void condatabase(string query)
{
SqlConnection con = new SqlConnection(constring());
con.Open();
SqlCommand cmd = new SqlCommand(query, con);
con.Close();
}
//button insert
dbcon db = new dbcon();
db.condatabase("INSERT INTO QcPlant(Qcdaily,NoMc,NoScrew1,NoScrew2,Nopeed,Commander,remark,status) VALUES ('" + @Daily.Text + "','" + @NoMc.Text + "','" + @Noscrew1.Text + "','" + @Noscrew2.Text + "','" + @Nopeed.Text + "','" + @Commander.Text + "','" + @Remark.Text + "','" + Label1.Text + "')");
Tag : .NET, Ms SQL Server 2008, Web (ASP.NET), C#, Bootstrap Framework
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2022-05-05 08:46:00 |
By :
dRufFy |
View :
746 |
Reply :
2 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
มันมีเครื่องมือ
https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.parameters?view=dotnet-plat-ext-6.0
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2022-05-05 15:00:51 |
By :
Chaidhanan |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|