TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Azarudeen Ibn Liyakath Ali
NA
31
6.6k
Generate Auto Request ID and UpdateDate
Jul 20 2014 4:52 AM
Hi All,
I want to Import the date from Excel and show it in Grid view and also It should be inserted into SQL.
Below is my code which is importing data from Excel and show it in Gridview and inserting in SQL perfectly.
private void InsertData()
{
for (int i = 0; i < Dt.Rows.Count; i++)
{
DataRow row = Dt.Rows[i];
int columnCount = Dt.Columns.Count;
string[] columns = new string[columnCount];
for (int j = 0; j < columnCount; j++)
{
columns[j] = row[j].ToString();
}
conn.Open();
string sql = "INSERT INTO ParcelInf(RequestID,SubdivisionNo,ParcelNo,Region,City,Zone,CoordinateSystem,CUID,Status,Remarks,UpdateDate)";
sql += "VALUES('" + columns[0] + "','" + columns[1] + "','" + columns[2] + "','" + columns[3] + "','" + columns[4] + "','" + columns[5] + "','" + columns[6] + "','" + columns[7] + "','" + columns[8] + "','" + columns[9] + "','" + columns[10] + "')";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
}
But I want to create a Autogenerate RequestID (Ex:WithTodayDate) and also create a updateDate so that whenever User imports from excel it should generate Auto RequestID and UpdateDate in SQL.
Reply
Answers (
4
)
How to add 'SQLiteWinRTPhone' Reference in VS Project for WP
SQL Server Parse Key Value from text