C#: Add SQLiteDataAdapter examples.

This commit is contained in:
Michael Nebel
2022-07-29 12:35:16 +02:00
parent ce9baaa1f3
commit 1fb209990e

View File

@@ -2,7 +2,7 @@ using System;
namespace TestSqlite
{
using System.Data;
using System.Data.SQLite;
using System.Web.UI.WebControls;
@@ -22,6 +22,21 @@ namespace TestSqlite
cmd = new SQLiteCommand(untrustedData.Text, connection);
}
SQLiteDataAdapter adapter;
DataSet result;
// BAD: untrusted data is not sanitized.
using (var connection = new SQLiteConnection(connectionString))
{
adapter = new SQLiteDataAdapter(untrustedData.Text, connection);
result = new DataSet();
adapter.Fill(result);
}
// BAD: untrusted data is not sanitized.
adapter = new SQLiteDataAdapter(untrustedData.Text, connectionString);
result = new DataSet();
adapter.Fill(result);
}
}
}