Note that there are some explanatory texts on larger screens.

plurals
  1. POCant insert >1000 records in VS 2012 SqlExpress
    primarykey
    data
    text
    <p>Uhmm well .. i have a local DB .. created using VS 2012 .. not the LocalDB .. its SqlExpress x64 ..</p> <p>i have a C# program that reads and parses a txt file .. and converts the data into records .. and around 200,000 records are inserted in one flow of execution .. the program parses and creates a insert query and executes it ..</p> <p>i have used Sql objects .. SqlCommand .. SqlConnection ..... for insertion ..</p> <p>the problem is that the console C# application does show that all records are inserted successfully till last count .. </p> <p>but i can see only 1000 records in DB Table ..</p> <p>Code to insert: </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Data.SqlClient; using System.IO; namespace SentiWordDBPopulate { class DBPopulateSentiWord { static SqlCommand sqlCmd; static SqlConnection sqlConn; static void Main(string[] args) { try { sqlConn = new SqlConnection("server=localhost\\SqlExpress; DataBase=WordDBForBlogMiner; integrated security=true"); sqlConn.Open(); //sqlCmd = new SqlCommand("select * from KWTable", sqlConn); //skip 1st 13 lines //for (int i = 1; i &lt;= 13; i++) //fin.ReadLine(); string[] lines = File.ReadAllLines("C:\\Users\\Ritesh\\Desktop\\WordDB.txt"); Console.WriteLine("Done reading! Press enter to insert everything into DB."); Console.Read(); long IDCounter = 0; //enter next 117658 lines into DB for (int i = 13; i &lt; lines.Length; i++) { //string line =fin.ReadLine(); string[] s = (lines[i].Remove(lines[i].IndexOf('#')).Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries)); //s[5] = s[6] = null; s[2] = s[2].Equals("NaN") ? "0" : s[2]; s[3] = s[3].Equals("NaN") ? "0" : s[3]; float tempNegScore = float.Parse(s[3]), tempPosScore = float.Parse(s[2]); int negScore = (int)Math.Round((tempNegScore * 27), MidpointRounding.AwayFromZero); int posScore = (int)Math.Round((tempPosScore * 31), MidpointRounding.AwayFromZero); if (posScore &lt;= 31 &amp;&amp; negScore &lt;= 27) { //Console.WriteLine((++IDCounter) + "\t =&gt; " + s[0] + "\t" + posScore + "\t" + negScore + "\t" + s[4]); string category = ""; if (posScore.Equals(0) &amp;&amp; negScore.Equals(0)) category = "neutral"; else if (posScore &gt; 0 &amp;&amp; negScore.Equals(0)) category = "positive"; else if (posScore.Equals(0) &amp;&amp; negScore &gt; 0) category = "negative"; else if (posScore &gt; 0 &amp;&amp; negScore &gt; 0) category = "PosNeg"; string query = "insert into SentiWordKWTable values ('" + s[0] + "', " + (++IDCounter) + ", " + posScore + ", " + negScore + ", '" + s[4].Replace("'", "") + "', '" + category + "')"; sqlCmd = new SqlCommand(query, sqlConn); sqlCmd.ExecuteNonQuery(); Console.WriteLine("Record Num: " + IDCounter + " successfully inserted!"); } else { Console.WriteLine((++IDCounter) + "\t =&gt; " + s[0] + "\t" + posScore + "\t" + negScore + "\t" + s[4]); break; } tempNegScore = tempPosScore = 0; posScore = negScore = 0; } Console.Read(); } catch (Exception e) { Console.WriteLine("Exception occured =&gt; " + e.Message); sqlCmd = new SqlCommand("delete from SentiWordKWTable", sqlConn); sqlCmd.ExecuteNonQuery(); Console.WriteLine("all rows of table deleted"); } Console.Read(); } } </code></pre> <p>}</p> <p>it was not a problem earlier in VS 2008 .. is there some restriction in VS 2012 .. or something to enable for >1000 insertion? ..</p>
    singulars
    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