これは私が知っている非常に簡単になるだろう。私は実際の標準とasp.netでSQLを使用する非常に多くの異なる方法を見てきました。私が知りたいのは、asp.netのSQLデータベースからきれいに選択し、複数のレコードを取得する方法です。たとえば、すべてのユーザーIDを選択します。Asp.Netで選択してください
String sql =
"SELECT [UserId] FROM [UserProfiles] WHERE NOT [UserId] = 'CurrentUserId'";
string strCon = System.Web
.Configuration
.WebConfigurationManager
.ConnectionStrings["SocialSiteConnectionString"]
.ConnectionString;
SqlConnection conn = new SqlConnection(strCon);
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
/*
This is where I need to know how to retrieve the information from the
above command(comm). I am looking for something similiar to php's
mysql_result. I want to access the records kind of like an array or some
other form of retrieving all the data.
Also when the new SqlCommand is called...does that actual run the
SELECT STATEMENT or is there another step.
*/
conn.Close();
SqlCommandが注射を妨げるために+1します。 – jww