I took your code and for the most part is worked ok. I filled in some of the blanks and got this code to complie and run: OleDbConnection cn = new OleDbConnection("User ID=xxx;Password=xxx;Initial Catalog=Northwind;Data Source=192.168.0.1;Provider=SQLOLEDB"); cn.Open(); System.Data.OleDb.OleDbCommand cmdGetNewClients = new System.Data.OleDb.OleDbCommand(); cmdGetNewClients.CommandText = @"SELECT LastName FROM Employees"; cmdGetNewClients.Connection = cn; OleDbDataReader rdr = cmdGetNewClients.ExecuteReader(); ArrayList newClients = new ArrayList(); while(rdr.Read()) newClients.Add(rdr["LastName"]); <-- change made here rdr.Close(); cn.Close(); Good luck.
squawk
Posts
-
OleDbException error -
OleDbException errorTry something like this: try { //insert your code here } catch(OleDbException ex) { Console.WriteLine("Message: " + ex.Message + "\n"); if(ex.InnerException != null) Console.WriteLine("Message: " + ex.InnerException.Message + "\n"); foreach(OleDbError e in ex.Errors) Console.WriteLine(e.Message + "\n"); }
-
OleDbException errorThe error is too general. Wrap the code in a try catch block and see what the true error is. If you catch and exception of type SqlException you can try this: foreach(SqlError err in sqlEx.Errors) Console.Writeline(e.Message); Otherwise just check the InnerException. It could be something simple like a login issue.
-
DataGrid questionHello, If you want to display specific rows based on the values they contain, you can create a DataView, and set the RowFilter property. Then bind the Datagrid to the DataView.
-
TimeOut exception with HttpWebRequest.getResponse but not with IESorry dude. Here it is:
-
Watching for a fileIt is the FileSystemWatcher class. It responds to different events such as create, change, renamed etc.
-
TimeOut exception with HttpWebRequest.getResponse but not with IEThere is something wrong with the headers. I was getting this error: "The underlying connection was closed: The server committed an HTTP protocol violation." put this in your config file and it should resolve the issue.