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
Logesh Kumar
1.5k
243
31.8k
Consume WCF service into Web Application
Feb 28 2019 1:03 AM
Here it's my Code (WCF Service Insert Operation)
how to Insert In an web Application (How to Consume WCF Service to Web Application)
public List<sResponse> mstrConfigurationType(mstrConfigurationType Type)
{
string sReturn = string.Empty;
List<sResponse> objS = new List<sResponse>();
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
SqlCommand cmd = new SqlCommand
("ConfigurationType", con);//ProcedureName(ConfigurationType)
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@QueryType", "Insert");
cmd.Parameters.AddWithValue("@TypeId", Type.TypeId);
cmd.Parameters.AddWithValue("@TypeName", Type.TypeName);
cmd.Parameters.AddWithValue("@ActiveStatus", Type.ActiveStatus);
cmd.Parameters.AddWithValue("@CreatedBy", Type.CreatedBy);
SqlParameter RuturnValue = new SqlParameter("@SQLReturn", SqlDbType.VarChar, 50);
RuturnValue.Direction = ParameterDirection.Output;
cmd.Parameters.Add(RuturnValue);
con.Open();
cmd.ExecuteNonQuery();
sReturn = cmd.Parameters["@SQLReturn"].Value.ToString();
//string[] sResult = sReturn.Split('~');
con.Close();
if (sReturn.Trim() == "Success")
{
objS.Add(new sResponse()
{
Status = "Ok",
Response = sReturn
});
return objS;
}
else if (sReturn.Trim() == "Already")
{
objS.Add(new sResponse()
{
Status = "Og",
Response = sReturn
});
return objS;
}
else
{
objS.Add(new sResponse()
{
Status = "Bad-request",
Response = sReturn
});
return objS;
}
}
catch (Exception ex)
{
objS.Add(new sResponse()
{
Status = "Bad-request",
Response = ex.Message
});
return objS;
}
}
Reply
Answers (
1
)
Consume WCF service into Web Application
Gridview - Update field while being on row edit mode