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
raju m
NA
3
665
Object cannot be cast from DBNull to other types.
Dec 19 2015 5:52 AM
my code is
private int GetNextStudentID()
{
command.CommandText = "SELECT IDENT_CURRENT ('admn') + IDENT_INCR ('admn')";
try
{
connection.Open();
int nextID = Convert.ToInt32(command.ExecuteScalar());// here i am getting error
return nextID;
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
connection.Close();
}
return 0;
}
Reply
Answers (
2
)
How to pass Null for DataTime Value
how to Implicitly intilization of the var datatype in Switch