SQL数据集未被覆盖

时间:2016-03-11 14:54:56

标签: sql visual-studio-2012

在我的visual studio 2013代码中,我使用循环来生成多条信息,但是我的SQL语句创建的数据集似乎并没有在每个循环上进行更新。

问题出现在第二个循环中,其中语句为:

/**
 * Grid constructor
 * @param width
 * @param height
 */
Grid(int, int);

/**
 * Function that displays grid on std output
 */
void displayCells(void) const;

/**
 * Tells if cell is in grid
 * @param cell x
 * @param cell y
 * @return true if is in the grid, otherwise false
 */
bool isCellInGrid(int, int) const;

执行代码时生成的控制台日志:

playerName = ds.tables("Standings").Rows(0).item(2) will only access the first value found

SQL = "SELECT * FROM Standings WHERE (TournamentID) = (" & TournamentId & ") AND PlayerID = (" & player1ID & ")"
        Console.WriteLine(SQL)

playerName = ds.Tables("Standings").Rows(0).Item(2).ToString
        Console.WriteLine(playerName)
        player1Name = playerName

        Console.WriteLine(player1Name)

完整代码:

(如果出现另一个影响它的错误)

Participants = 16

New Loop
0
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
475
18
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (18)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 475

New Loop
2
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
477
31
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (31)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 477

New Loop
4
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
479
34
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (34)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 479

New Loop
6 
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
481
17
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (17)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 481

New Loop
8
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information 
483
33
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (33)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 483

New Loop
10
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
485
28
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (28)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 485

New Loop
12
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
487
29
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (29)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 487

New Loop
14
SELECT * FROM Pairings WHERE TournamentId = ('2') AND RoundNumber = ('1')

New Information
489
24
SELECT * FROM Standings WHERE (TournamentID) = (2) AND PlayerID = (24)
Raspberry
Raspberry
UPDATE Pairings SET Player1Name='Raspberry' WHERE MatchID = 489

0 个答案:

没有答案