Visa ett inlägg
Oläst 2005-11-05, 21:05 #3
samuel99 samuel99 är inte uppkopplad
Nykomling
 
Reg.datum: Dec 2003
Inlägg: 14
samuel99 samuel99 är inte uppkopplad
Nykomling
 
Reg.datum: Dec 2003
Inlägg: 14
Ah, underbart med snabba svar. Min kod ser nu ut som följer:

Kod:
<%@ Import Namespace="System.Data.OleDb" %>
<%
string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;User Id=admin;Password=;";
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from tblEvent";
OleDbConnection conn = new OleDbConnection(connStr);

try
{
	conn.Open();  // Öppna mot databasen
	cmd.Connection = conn;
	dataGrid.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
	dataGrid.DataBind();
}
catch(Exception ex)
{

}%>
Jag får då felet
Kod:
 Compiler Error Message: CS0246: The type or namespace name 'CommandType' could not be found (are you missing a using directive or an assembly reference?)
Har jag missat att inkludera någon referens?
samuel99 är inte uppkopplad   Svara med citatSvara med citat