1.
int intNum = 11;if (intNum == 10)
{}
else
{}2.
x = a==b?c:d;
==> is similar to
if (a==b)
x = c;
else
x = d;3.
something like (did not test, so there might be errors):void Page_Load(Object sender, EventArgs e)
{
String strConnection ="Private........";
String strCommand ="Select * From tableName";
OleDbConnection objConnection = new OleDbConnection(strConn);
OleDbCommand objCommand = new OleDbCommand(strCommand,objConnection);
OleDbDataReader objReader;
try
{
objConnection.Open();
objReader = objCommand.ExecuteReader();
}
catch(Exception objErr)
{
errTxt.Text = objErr.Message + objErr.Source;
}
}
int intNum = 11;if (intNum == 10)
{}
else
{}2.
x = a==b?c:d;
==> is similar to
if (a==b)
x = c;
else
x = d;3.
something like (did not test, so there might be errors):void Page_Load(Object sender, EventArgs e)
{
String strConnection ="Private........";
String strCommand ="Select * From tableName";
OleDbConnection objConnection = new OleDbConnection(strConn);
OleDbCommand objCommand = new OleDbCommand(strCommand,objConnection);
OleDbDataReader objReader;
try
{
objConnection.Open();
objReader = objCommand.ExecuteReader();
}
catch(Exception objErr)
{
errTxt.Text = objErr.Message + objErr.Source;
}
}
1. 所有代码都要加上;
2. VB.net里面的End 没有了,改成{}
3. 还有就是声明对象,对象类名放在前面