This commit is contained in:
Simon SAYE BABU 2023-11-22 16:37:13 +01:00
parent 497a7f856b
commit 1a35bf185b
5 changed files with 13 additions and 5 deletions

7
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"java.project.referencedLibraries": [
"lib/**/*.jar",
"DEV3.1/BDD_java/mariadb-java-client-3.2.0.jar",
"c:\\Users\\simon\\Downloads\\mysql-connector-j-8.2.0.jar"
]
}

Binary file not shown.

Binary file not shown.

View File

@ -11,14 +11,15 @@ public class vote
try
{
Class.forName("org.mariadb.jdbc.Driver");
Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/sayebabu","sayebabu", "kjrzB5S4kqKAwdT");
try
{
PreparedStatement pst = cnx.prepareStatement("SELECT PaysID FROM `Pays` WHERE Pays = '?'");
PreparedStatement pst = cnx.prepareStatement("SELECT PaysID FROM `Pays` WHERE Pays = ?");
pst.setString(1, args[0]);
ResultSet rs = pst.executeQuery();
int paysID = rs.getInt(1);
pst = cnx.prepareStatement("SELECT PaysVoteID, Points FROM `Comp` WHERE PaysCompID = '?'");
pst = cnx.prepareStatement("SELECT PaysVoteID, Points FROM `Comp` WHERE PaysCompID = ?");
pst.setInt(1, paysID);
int sumVote = 0;
@ -28,7 +29,7 @@ public class vote
int votants = rs.getInt(2);
sumVote+=votants;
PreparedStatement pst2 = cnx.prepareStatement("SELECT Pays FROM `Pays` WHERE PaysID = '?'");
PreparedStatement pst2 = cnx.prepareStatement("SELECT Pays FROM `Pays` WHERE PaysID = ?");
pst2.setInt(1, comp);
ResultSet rs2 = pst.executeQuery();
rs2.next();
@ -43,13 +44,13 @@ public class vote
catch (Exception e)
{
cnx.close();
System.out.printf("TA MERE");
System.out.printf("TA MERE2"+e);
}
}
catch (Exception e)
{
System.out.printf("TA MERE");
System.out.printf("TA MERE1"+ e);
}
}
}

View File