PDA

View Full Version : مبتدی: best overloaded method



noth50
یک شنبه 01 بهمن 1391, 14:47 عصر
بادرود
برای فراخوانی متد (استفاده از وب سرویس)
public static string SendSms(string recnumbermassege, string textmassege, string sendnumbermassege, string username, string pass)
{
string[] rec = recnumbermassege.Replace("\r", "").Split(new char[] { '\n' });
recnumbermassege.Split();

string txt = textmassege;

string num = sendnumbermassege;

long[] recid = null;
byte[] status = null;
SendSms.Send sms = new SendSms.Send();
int retval = sms.SendSms(username, pass, rec, num, txt, false, "", ref recid, ref status);
return retval.ToString();
}
با پیغام ,the best overloaded method match for ClassConnection.SendSms strimg,string,string,string,string hassome invalid arguments
مواجه می شوم
متد فراخوانی
protected void Button1_Click(object sender, EventArgs e)
{
ClassConnection.SendSms( TRecNumber, TText, DSendNumber, TUserName, TPas);

}

بهترین باشید

plus
یک شنبه 01 بهمن 1391, 14:57 عصر
آرگومان ها رو مطابق با لیست پارامترهای متد نفرستادین.Document وب سرویس رو دوباره مطالعه کنید.

noth50
یک شنبه 01 بهمن 1391, 15:15 عصر
من این متد رو استفاده کردم و مشکلی نداشتم فقط در زمانی که میخواهم فراخوانی را انجام دهم با این مشکل مواجه می شود
string[] rec = TextBox1.Text.Replace("\r", "").Split(new char[] { '\n' });
TextBox1.Text.Split();

string txt = TextBox2.Text;

string num = DropDownList1.SelectedItem.Text;

long[] recid = null;
byte[] status = null;
com.farapayamak.Send sms = new com.farapayamak.Send();
int retval= sms.SendSms("tajari", "22462391", rec, num, txt, false, "", ref recid, ref status);
Response.Write(retval);
من از کد بالا استفاده کرده ام و مشکلی ندارم درصورت امکان لطف بفرمایید در رابطه با آرگومان بیشتر توضیح بفرمایید
باتشکر

plus
یک شنبه 01 بهمن 1391, 15:43 عصر
لطفا کدتون رو در تگ CSHARP بگذارین که خوانا بشه.
اینجا:

ClassConnection.SendSms( TRecNumber, TText, DSendNumber, TUserName, TPas);

آرگومان هایی که به متدی که نوشتین دادین با متد نمیخونن.باید همه string باشن.طبق تعریف متد:

public static string SendSms(string recnumbermassege, string textmassege, string sendnumbermassege, string username, string pass)

noth50
یک شنبه 01 بهمن 1391, 15:57 عصر
در کد بالا درج شده بود که من فقط ار استرینگ استفاده کرده ام


public static string SendSms(string recnumbermassege, string textmassege, string sendnumbermassege, string username, string pass)
{
string[] rec = recnumbermassege.Replace("\r", "").Split(new char[] { '\n' });
recnumbermassege.Split();

string txt = textmassege;

string num = sendnumbermassege;

long[] recid = null;
byte[] status = null;
SendSms.Send sms = new SendSms.Send();
int retval = sms.SendSms(username, pass, rec, num, txt, false, "", ref recid, ref status);
return retval.ToString();
}

noth50
یک شنبه 01 بهمن 1391, 16:07 عصر
مشکلم برطرف شد ممنون از راهنمایی شما