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
Abdul Raheem Mohammad
NA
8
1.4k
Is I'm Following Correct Coding Standard
Jul 10 2015 2:24 AM
public String InsertDimensionInformation(String pDimensionCode, String pLength, String pWidth, String pHeight, string CustomerID, String ppartNumber)
{
SqlConnection SqlCon = new SqlConnection(constr);
try
{
SqlCommand SqlCmd3 = new SqlCommand("select Partnumber from dimensions where Partnumber=" + ppartNumber.ToString() + " ", SqlCon);
if (SqlCon.State == ConnectionState.Closed) { SqlCon.Open(); }
String result;
try
{
SqlDataReader dr = SqlCmd3.ExecuteReader(CommandBehavior.CloseConnection);
if (dr.Read())
{
result = "The PartNumber is already existed";
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
dr.Close();
return result;
}
dr.Close();
}
catch (Exception ex)
{
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
}
finally
{
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
}
SqlCommand SqlCmd = new SqlCommand("sp_select_dimensions", SqlCon);
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlCmd.Parameters.AddWithValue("@LENGTH", pLength);
SqlCmd.Parameters.AddWithValue("@WIDTH", pWidth);
SqlCmd.Parameters.AddWithValue("@HEIGHT", pHeight);
SqlCmd.Parameters.AddWithValue("@CUSTOMERID", CustomerID);
SqlCmd.Parameters.AddWithValue("@PartNumber", ppartNumber);
if (SqlCon.State == ConnectionState.Closed) { SqlCon.Open(); }
try
{
SqlDataReader dr = SqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
if (dr.Read())
{
result = "The combination is already existed";
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
dr.Close();
return result;
}
dr.Close();
}
catch (Exception ex)
{
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
}
finally
{
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
}
SqlCmd = new SqlCommand("sp_curd_dimensions", SqlCon);
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlCmd.Parameters.AddWithValue("@OPERATIONS", "INSERT");
SqlCmd.Parameters.AddWithValue("@LENGTH", pLength);
SqlCmd.Parameters.AddWithValue("@WIDTH", pWidth);
SqlCmd.Parameters.AddWithValue("@HEIGHT", pHeight);
SqlCmd.Parameters.AddWithValue("@DIMENSIONCODE", pDimensionCode);
SqlCmd.Parameters.AddWithValue("@CUSTOMERID", CustomerID);
SqlCmd.Parameters.AddWithValue("@PartNumber", ppartNumber);
if (SqlCon.State == ConnectionState.Closed) { SqlCon.Open(); }
int strResult = SqlCmd.ExecuteNonQuery();
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
if (strResult == 1)
return "Success";
else
return strResult.ToString();
}
catch (Exception ex)
{
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
return ex.Message;
}
finally
{
if (SqlCon.State == ConnectionState.Open)
SqlCon.Close();
}
}
Reply
Answers (
1
)
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered
How to Create Chart Label for Count