-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDatabaseManager.cs
33 lines (29 loc) · 1004 Bytes
/
DatabaseManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Proyecto_Reproductor
{
public class DatabaseManager
{
private string connectionString;
public DatabaseManager(string connectionString)
{
this.connectionString = connectionString;
}
public void GuardarRutaImagen(int userId, string imagePath)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
string updateQuery = "UPDATE Users SET u_image_path = @ImagePath WHERE u_id = @UserId";
SqlCommand command = new SqlCommand(updateQuery, connection);
command.Parameters.AddWithValue("@ImagePath", imagePath);
command.Parameters.AddWithValue("@UserId", userId);
command.ExecuteNonQuery();
}
}
}
}