I Want To Convert SqlCommand Result into Int Value How Can i Do that?? Please Help With That What I Have Tried IS Below:
The stp_no in Table Have Set Identity Property. And I want To insert That Auto Generated Numbers into Another Table But It Shows Always Error Like "Connot Convert SqlCommand Type to Int Type"
SqlCommand dvgcmd, snocmd;
snocmd = new SqlCommand("SELECT stp_no FROM MaterialTestMaster", con);
dvgcmd = new SqlCommand("INSERT INTO MaterialTestDetail(stp_no,test_no,test_name,test_type,test_spec,high_limit,low_limit)" +
"VALUES('"+ snocmd +"','" + @matTstDataGridView.Rows[j].Cells[0].Value + "'," +
" '" + @matTstDataGridView.Rows[j].Cells[1].Value + "'," +
" '" + @matTstDataGridView.Rows[j].Cells[2].Value + "'," +
" '" + @matTstDataGridView.Rows[j].Cells[3].Value + "'," +
" '" + @matTstDataGridView.Rows[j].Cells[4].Value + "'," +
" '" + @matTstDataGridView.Rows[j].Cells[5].Value + "')", con);
Please Help M to Solve This Problem :)