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
Danish Habib
NA
694
244k
I am getting a Network or instance related error with my ap
Oct 12 2015 1:14 AM
I have a application in which in app.config i mentioned my connection string such as
<add name="DMS_2008_Data.Properties.Settings.Default.DataConnection"
connectionString="Data Source=ASPKCO-DANISH\SQLEXPRESS1;Initial Catalog=DMS2008;Integrated Security=True;Connect Timeout=30"
providerName="System.Data.SqlClient" />
and in code i am using this line
public ClsUserLoging IsValidLog(string UserID, string PassWord)
{
try
{
objClsUsers = null;
con = new SqlConnection(DMS_2008_Data.Properties.Settings.Default.DataConnection.ToString());
con.Open();
com = new SqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = "SELECT UserName, IsNever, CreateDate, ValidDays, ExpireDate FROM Users WHERE (UserID = @UserID) AND (UserPassWord = @UserPassWord)";
com.Parameters.Add("@UserID", SqlDbType.NVarChar, 30).Value = UserID.ToString().Trim();
com.Parameters.Add("@UserPassWord", SqlDbType.NVarChar, 60).Value = PassWord.ToString().Trim();
reader = com.ExecuteReader();
while (reader.Read())
{
objClsUsers = new ClsUserLoging();
objClsUsers.UserName = reader.GetString(0).ToString();
objClsUsers.Never = reader.GetBoolean(1);
objClsUsers.CreateDate = reader.GetDateTime(2);
objClsUsers.ValidDays = (short)reader.GetInt32(3);
objClsUsers.ExpireDate = reader.GetDateTime(4);
}
reader.Close();
com.Parameters.Clear();
}
catch (Exception ex)
{
objClsUsers = null;
throw ex;
}
finally
{
if (com != null)
com.Dispose();
if (con != null)
con.Dispose();
com = null;
con = null;
}
return objClsUsers;
}
I am getting an error a network or instance related error occured and there is not issue with DB and connection string because i am using another web application accessing the same db using web.config please assist
Reply
Answers (
12
)
Visible and collapse not working
Top Alignment not same