Wcf服务帮助Visual Webpart问题 [英] Wcf Service Help Visual Webpart problem
本文介绍了Wcf服务帮助Visual Webpart问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个wcf服务应用程序,在我的可视化Web部件中,我有一个搜索按钮和一些文本框,我的按钮看起来像这样,''
i have created an wcf service application and in my visual webpart i have an search button an some textboxes my button looks like this, ''
int id;
bool ok = int.TryParse(TextBoxSearch.Text, out id);
if (ok)
{
}
var service = new ServiceReference.Service1Client("http://localhost:54187/Service1.svc");
try
{
var product = service.GetProduct(id);
UpdateTextBoxes(product);
}
catch (Exception)
{
throw new FaultException();
}
}
private void UpdateTextBoxes(Product product)
{
TextBoxName.Text = product.ProductName;
TextBoxProductNumber.Text = product.ProductNumber;
TextBoxListPrice.Text = product.ListPrice.ToString(CultureInfo.InvariantCulture);
TextBoxColor.Text = product.Color;
TextBoxSearch.Text = product.ProductID.ToString(CultureInfo.InvariantCulture);
}
当按下按钮时,我得到
错误
发生意外错误
和随机校正ID每次,我都不知道该怎么做:(
and when pressing the button i get
Error
An unexpected error has occurred
and randoms Correction id everytime , i dont know what to do:(
推荐答案
Hello,
我更喜欢VB,而不是C或Java,但看着大括号,我不确定,但我可能会猜测您在哪里
Hello,
I''m more into VB than C or java but looking at your curly brackets,Im not sure but i would hazard a guess that where you have
if (ok)
{
}
您应该删除}
也许那是对的,但我可能是错的.
You should remove the }
And maybe thats right, but i could be wrong.
这篇关于Wcf服务帮助Visual Webpart问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文