R
rex64
I created a datagrid and it worked great in the regular C#. But when I
do the exact same thing in ASP it does not work.
private void btnSignUp_Click(object sender, System.EventArgs e)
{
string connectionString="data source=JEFF-3KQH2O8TJF;initial
catalog=studyXSQL3;Integrated Security=SSPI";
SqlConnection studyXconnection=new SqlConnection(connectionString);
string selectStatement = "SELECT postID, userName, Post, Date,
Views "
//+ "ProductTotal, SalesTax, ShippingAndHandling, InvoiceTotal "
+ "FROM Posts ";
// + "WHERE CustomerID = @CustomerID "
// + "ORDER BY InvoiceID";
//studyXconnection.Open();
//SqlCommand selectCommand = new SqlCommand(selectStatement,
studyXconnection);
//selectCommand.ExecuteNonQuery();
SqlDataAdapter invoicesDataAdapter = new
SqlDataAdapter(selectStatement, studyXconnection);
DataSet invoicesDataSet = new DataSet();
invoicesDataAdapter.Fill(invoicesDataSet, "Posts");
grdPosts.AutoGenerateColumns = true;
grdPosts.DataSource = invoicesDataSet.Tables["Posts"];
invoicesDataAdapter.Update(invoicesDataSet,"Posts");
//grdPosts.
//studyXconnection.Close();
}
do the exact same thing in ASP it does not work.
private void btnSignUp_Click(object sender, System.EventArgs e)
{
string connectionString="data source=JEFF-3KQH2O8TJF;initial
catalog=studyXSQL3;Integrated Security=SSPI";
SqlConnection studyXconnection=new SqlConnection(connectionString);
string selectStatement = "SELECT postID, userName, Post, Date,
Views "
//+ "ProductTotal, SalesTax, ShippingAndHandling, InvoiceTotal "
+ "FROM Posts ";
// + "WHERE CustomerID = @CustomerID "
// + "ORDER BY InvoiceID";
//studyXconnection.Open();
//SqlCommand selectCommand = new SqlCommand(selectStatement,
studyXconnection);
//selectCommand.ExecuteNonQuery();
SqlDataAdapter invoicesDataAdapter = new
SqlDataAdapter(selectStatement, studyXconnection);
DataSet invoicesDataSet = new DataSet();
invoicesDataAdapter.Fill(invoicesDataSet, "Posts");
grdPosts.AutoGenerateColumns = true;
grdPosts.DataSource = invoicesDataSet.Tables["Posts"];
invoicesDataAdapter.Update(invoicesDataSet,"Posts");
//grdPosts.
//studyXconnection.Close();
}