Click here to Skip to main content
15,881,380 members
Home / Discussions / C#
   

C#

 
AnswerRe: c# error Pin
Emmanuel Medina5-Jul-13 10:01
professionalEmmanuel Medina5-Jul-13 10:01 
GeneralRe: c# error Pin
User34905-Jul-13 10:36
User34905-Jul-13 10:36 
GeneralRe: c# error Pin
Emmanuel Medina8-Jul-13 2:42
professionalEmmanuel Medina8-Jul-13 2:42 
GeneralRe: c# error Pin
User34908-Jul-13 3:34
User34908-Jul-13 3:34 
GeneralRe: c# error Pin
User34906-Jul-13 7:16
User34906-Jul-13 7:16 
AnswerRe: c# error Pin
Mycroft Holmes5-Jul-13 14:09
professionalMycroft Holmes5-Jul-13 14:09 
AnswerRe: c# error Pin
Richard MacCutchan5-Jul-13 22:28
mveRichard MacCutchan5-Jul-13 22:28 
GeneralRe: c# error Pin
User34906-Jul-13 10:25
User34906-Jul-13 10:25 
OleDbConnection dbConnDest;
dbConnDest = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source= SystemA.accdb");


string query_select = "SELECT ReferenceYear FROM [MS Access;DATABASE=" + dialog.FileName + "].Questionnaires_Table1 Where ReferenceYear = '" + txtdateref.Text + "';";


OleDbCommand cmd_year = new OleDbCommand(query_select, dbConnDest);


dbConnDest.Open();

string rfyear = cmd_year.ExecuteScalar().ToString();

if (rfyear == null) { MessageBox.Show(" file not found with this ref year ", "", MessageBoxButtons.OK); }


dbConnDest.Close();



i have error in following row

string rfyear = cmd_year.ExecuteScalar().ToString();


if the query is wrong appears the error:
------------------------------------------
Object reference not set to an instance of an object.
GeneralRe: c# error Pin
NotPolitcallyCorrect6-Jul-13 10:35
NotPolitcallyCorrect6-Jul-13 10:35 
GeneralRe: c# error Pin
Eddy Vluggen6-Jul-13 11:35
professionalEddy Vluggen6-Jul-13 11:35 
GeneralRe: c# error Pin
User34906-Jul-13 12:15
User34906-Jul-13 12:15 
GeneralRe: c# error Pin
Eddy Vluggen9-Jul-13 8:55
professionalEddy Vluggen9-Jul-13 8:55 
GeneralRe: c# error Pin
Richard MacCutchan6-Jul-13 21:42
mveRichard MacCutchan6-Jul-13 21:42 
GeneralRe: c# error Pin
User34907-Jul-13 4:26
User34907-Jul-13 4:26 
GeneralRe: c# error Pin
Richard MacCutchan7-Jul-13 7:21
mveRichard MacCutchan7-Jul-13 7:21 
GeneralRe: c# error Pin
User34907-Jul-13 8:28
User34907-Jul-13 8:28 
GeneralRe: c# error Pin
Richard MacCutchan7-Jul-13 20:38
mveRichard MacCutchan7-Jul-13 20:38 
QuestionC# SQL SELECT query taking too long Pin
IceUK5-Jul-13 5:48
IceUK5-Jul-13 5:48 
AnswerRe: C# SQL SELECT query taking too long Pin
fixthebugg5-Jul-13 6:00
fixthebugg5-Jul-13 6:00 
AnswerRe: C# SQL SELECT query taking too long Pin
Simon_Whale5-Jul-13 6:14
Simon_Whale5-Jul-13 6:14 
AnswerRe: C# SQL SELECT query taking too long Pin
Mycroft Holmes5-Jul-13 14:03
professionalMycroft Holmes5-Jul-13 14:03 
QuestionI am geting an error about callbackOnCollectedDelegate Pin
mahua225-Jul-13 2:11
mahua225-Jul-13 2:11 
AnswerRe: I am geting an error about callbackOnCollectedDelegate Pin
Ron Beyer5-Jul-13 3:40
professionalRon Beyer5-Jul-13 3:40 
AnswerRe: I am geting an error about callbackOnCollectedDelegate Pin
Alan N5-Jul-13 3:48
Alan N5-Jul-13 3:48 
GeneralRe: I am geting an error about callbackOnCollectedDelegate Pin
Ron Beyer5-Jul-13 4:44
professionalRon Beyer5-Jul-13 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.