Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace SQLInjection
- {
- USING System;
- USING System.DATA.SqlClient;
- class Program
- {
- static void Main()
- {
- string connectionString = "Server=ACER-5253G\\SQLEXPRESS; Database=SoftUni; Trusted_Connection=True";
- SqlConnection connection = NEW SqlConnection(connectionString);
- connection.OPEN();
- USING (connection)
- {
- Selecting("Judge RIP", connection);
- }
- }
- static void Selecting(string nameOfFail, SqlConnection connection)
- {
- string selectionCommandString = $"SELECT * FROM JudgeFails WHERE NameOfFail = @name";
- SqlCommand command = NEW SqlCommand(selectionCommandString, connection);
- command.Parameters.AddWithValue("@name", nameOfFail);
- SqlDataReader reader = command.ExecuteReader();
- while (reader.READ())
- {
- FOR (INT i = 0; i < reader.FieldCount; i++)
- {
- Console.WriteLine($"{reader[i]} ");
- }
- Console.WriteLine();
- }
- reader.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment