Note that there are some explanatory texts on larger screens.

plurals
  1. POGet one record at a time from SQL
    primarykey
    data
    text
    <p>This is the function that I use to display the row from the database. The default value is level 1, SID 1. If the user chooses from the dropdown list, the level can change, but the ID stays the same because I didn't know what to do here. I want to get one record at a time, but when I press the next button, I want to get the next row with the selected level. If that is possible, can you give me some tips on how to do this? Thank you in advance.</p> <pre><code> public void FillPageSpelling() { ArrayList videoList1 = new ArrayList(); if (!IsPostBack) { videoList1 = ConnectionClass.GetSpelling(1,1); } else { int i = Convert.ToInt32(DropDownList1.SelectedValue); videoList1 = ConnectionClass.GetSpelling(i,1); } StringBuilder sb = new StringBuilder(); foreach (Spelling sp in videoList1) { sb.Append( string.Format( @"&lt;table class='VideoTable'&gt; &lt;tr&gt; &lt;td align='center'&gt; &lt;font face='Verdana'&gt; &lt;input type=text style=display:none id=TextBox3 value={0}&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align='center'&gt; &lt;font face='Verdana'&gt; &lt;font size='3'&gt;Level:&lt;/font&gt; &lt;font size='2'&gt;{3}&lt;/font&gt; &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align='center'&gt; &lt;font face='Verdana'&gt; &lt;font size='3'&gt;Sentence:&lt;/font&gt; &lt;font size='2'&gt;{1}&lt;/font&gt; &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align='center'&gt; &lt;font size='3'&gt;Sound: &lt;audio controls&gt;&lt;source src=sound/{2}&gt;&lt;/audio&gt; &lt;font face='Verdana'&gt; &lt;font size='2'&gt;&lt;/font&gt; &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;tr&gt; &lt;td align='center'&gt; &lt;font face='Verdana'&gt; &lt;font size='3'&gt;Write the word here: &lt;input type=text id=TextBox1&gt; &lt;/font&gt; &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;td&gt; &lt;input type=button value='Check' class='p-userButton' onClick='ButtonClick(document.getElementById(""TextBox1"").value, document.getElementById(""TextBox2"").value);'/&gt; &lt;/td&gt; &lt;td&gt; &lt;input type=button value='Cheat' class='p-userButton' onClick='Cheat(document.getElementById(""TextBox2"").value);' &lt;/td&gt; &lt;td&gt; &lt;input type=button value='Next' class='p-userButton' &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align='center'&gt; &lt;font face='Verdana'&gt; &lt;input type=text style=display:none id=TextBox2 value={4}&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/br&gt; &lt;/table&gt;", sp.SID, sp.Sentence, sp.Audio, sp.Level, sp.Word)); lblOutput.Text = sb.ToString(); } } </code></pre> <p>Here is the method that returns one record based on the level and ID:</p> <pre><code> public static ArrayList GetSpelling(int level, int sid) { ArrayList list = new ArrayList(); string query = string.Format("SELECT * FROM Spelling WHERE Level LIKE '{0}' and SID LIKE '{1}'", level, sid); try { conn.Open(); command.CommandText = query; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int SID = reader.GetInt32(0); string Sentence = reader.GetString(1); string Word = reader.GetString(2); int Level = reader.GetInt32(3); string Audio = reader.GetString(4); Spelling lst = new Spelling(SID, Sentence, Word, Level, Audio); list.Add(lst); } } finally { conn.Close(); } return list; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload