PDA

View Full Version : سوال: ارور در زمان اجرا را چه طور برطرف کنیم؟



mohammadriano
چهارشنبه 04 مرداد 1391, 21:18 عصر
سلام
به این مثال توجه کنید
در #C :

try
{
textbox1.text = (22 * intparse(textbox2.text)).toString();
}
catch(FormatException ddd)
{
result.text = ddd.message;
}

حالا یک جای برنامه تو VB6 رو گذاشتم برای کوئری دستی

Private Sub Command1_Click()
On Error Resume Next
Data1.Refresh
Data1.RecordSource = Text2.Text
Data1.Refresh
End Sub

حالا اگه کوئری که در text2.text صحیح نبود کوئری به این شکل در بیاد


Data1.RecordSource = "select * from table1"

Veteran
چهارشنبه 04 مرداد 1391, 21:44 عصر
Private Sub Command1_Click()
On Error GoTo Error:
Data1.Refresh
Data1.RecordSource = Text2.Text
Data1.Refresh
GoTo NextLine:
Error:
Data1.RecordSource = "select * from table1"
Exit Sub
NextLine:
' edameye code ha
End Sub