>OleConnection nConn = new OleConnection("Your Connection String"); > >OleCommand OleCMD = new OleCommand("NewId", nConn); >OleCMD.CommandType = CommandType.StoredProcedure; > >SqlParameter myParm = OleCMD.Parameters.Add("@TableId", SqlDbType.NVarChar, 15); >myParm.Value = "User"; > >nConn.Open(); > >object oReturnValue = OleCMD.ExecuteScalar(); > >Console.WriteLine(oReturnValue.ToString()) > >That also doesn't work. Actually, the code you provided assumes I'm connecting to a SQL server database. I'm using OLE-DB to connect to a Visual FoxPro database. I adjusted the code to reference the OleDb class instead, but it fails with a "Input string was not in a correct format." error when ExecuteScaler() fires.