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
adam gills
NA
65
14.3k
A network-related or instance-specific error occurred
Dec 21 2016 8:12 AM
Sir,
Sqlconnection string is not again establish when I execute 'update' command after 8 to 10 minuts it's is mandatory.
and shown an error as :-
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The requested address is not valid in its context.) "
Code is given below
if (link == "Delete")
{
DateTime dat = DateTime.Now;
string tdate = dat.ToString("yyyy-MM-dd");
string ttime = dat.ToString("hh:mm:ss");
string procs = "Update ipinfo set deldata='1',username='" + setuser.Trim() + "', deletedate='" + tdate + "',deletetime='" + ttime + "',timediff=convert(varchar(5),DateDiff(s, worktime, '" + ttime + "')/3600)+':'+convert(varchar(5),DateDiff(s,worktime, '" + ttime + "')%3600/60)+':'+convert(varchar(5),(DateDiff(s,worktime, '" + ttime + "')%60))"
+ " where dataid='" + dgvuserinfo.Rows[e.RowIndex].Cells["ID"].Value + "' ";
cmd = new SqlCommand(procs, mycon);
mycon.Open();
cmd.ExecuteNonQuery();
mycon.Close();
refreshgrid();
}
Reply
Answers (
2
)
What is Microsoft Dynamics
Why can't I write just a try with no catch or finally?