Skip to main content

Posts

Showing posts from October, 2016

sql auto increment jump

You resolve your auto increment  jumping from this http://stackoverflow.com/questions/14146148/identity-increment-is-jumping-in-sql-server-database you can also resolve the issue into another way if you are using EDMX. Before inserting data into table get the max id value from your table. int maxAge = context.Persons.Max(p => p.Age); Now add your increment number  maxAge+1   Map the id value with your table. NB: You table Identity specification : Is Identity Will be no.

C# read word document and get specific data from document

// Reding all word document from a specific folder foreach (string file in Directory.EnumerateFiles(@"D:\", "*.doc")) { //string contents = File.ReadAllText(file); Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); object miss = System.Reflection.Missing.Value; object path = file; // @"D:\35339.doc"; object readOnly = true; Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss); string totaltext = ""; for (int i = 0; i < 2; i++) // i set value 2 you can change { totaltext += " \r\n " + docs.Paragraphs[i + 1].Range.Text.ToString(); } // Getting data after specif