Click here to Skip to main content
15,893,487 members
Home / Discussions / Database
   

Database

 
AnswerRe: Microsoft Sql Server and the Decimal Data Type Pin
Luc Pattyn9-Nov-09 7:38
sitebuilderLuc Pattyn9-Nov-09 7:38 
QuestionInvalid argument in a DateDiff() function Pin
TheJudeDude9-Nov-09 4:45
TheJudeDude9-Nov-09 4:45 
AnswerRe: Invalid argument in a DateDiff() function Pin
Luc Pattyn9-Nov-09 5:07
sitebuilderLuc Pattyn9-Nov-09 5:07 
GeneralRe: Invalid argument in a DateDiff() function Pin
TheJudeDude9-Nov-09 7:08
TheJudeDude9-Nov-09 7:08 
GeneralRe: Invalid argument in a DateDiff() function Pin
The Man from U.N.C.L.E.9-Nov-09 7:28
The Man from U.N.C.L.E.9-Nov-09 7:28 
GeneralRe: Invalid argument in a DateDiff() function Pin
TheJudeDude9-Nov-09 9:09
TheJudeDude9-Nov-09 9:09 
GeneralRe: Invalid argument in a DateDiff() function Pin
Luc Pattyn9-Nov-09 9:49
sitebuilderLuc Pattyn9-Nov-09 9:49 
GeneralRe: Invalid argument in a DateDiff() function Pin
TheJudeDude9-Nov-09 10:51
TheJudeDude9-Nov-09 10:51 
I shortened up the SQL a bit, but I am getting the same error The error is on DbReader = DbCommand.ExecuteReader():
OdbcConnection DbConnection = new OdbcConnection("DSN=rsss");
    OdbcCommand DbCommand = DbConnection.CreateCommand();
    DbCommand.CommandText = "SELECT TICKET-STORE, DATEDIFF(day,'" + strDate + "','" + strDate + "') AS EXP FROM TICKET";
    DbConnection.Open();
    try
    {
        DbReader = DbCommand.ExecuteReader();
        while(DbReader.Read())
        {
            intStore = Int32.Parse(DbReader["TICKET-STORE"].ToString());
        }
    }

    catch(OdbcException caught)
    {
        Console.WriteLine(caught.ToString());
        Console.Read();

        DbConnection.Close();
    }



Here is the error:
System.Data.Odbc.OdbcException: ERROR [HY000] Build Error: Invalid Function Name.  Function name is 'DATEDIFF'.
   at System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle, SQL_HANDLE hType, RETCODE retcode)
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method)
   at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Odbc.OdbcCommand.ExecuteReader()
   at acctmgr.Class1.Main(String[] args) in c:\documents and settings\brian\my documents\visual studio projects\acctmgr\class1.cs:line 43



Thanx for your help!

Jude

GeneralRe: Invalid argument in a DateDiff() function Pin
Luc Pattyn9-Nov-09 11:21
sitebuilderLuc Pattyn9-Nov-09 11:21 
GeneralRe: Invalid argument in a DateDiff() function Pin
TheJudeDude9-Nov-09 12:13
TheJudeDude9-Nov-09 12:13 
QuestionRestore Database from a Remote Backup Pin
Vimalsoft(Pty) Ltd9-Nov-09 3:37
professionalVimalsoft(Pty) Ltd9-Nov-09 3:37 
AnswerRe: Restore Database from a Remote Backup Pin
Eddy Vluggen9-Nov-09 7:04
professionalEddy Vluggen9-Nov-09 7:04 
GeneralRe: Restore Database from a Remote Backup Pin
Vimalsoft(Pty) Ltd9-Nov-09 19:21
professionalVimalsoft(Pty) Ltd9-Nov-09 19:21 
GeneralRe: Restore Database from a Remote Backup Pin
Eddy Vluggen10-Nov-09 3:54
professionalEddy Vluggen10-Nov-09 3:54 
Questionhow to merge or copy one database to another at Midnight every day Pin
It_tech9-Nov-09 1:48
It_tech9-Nov-09 1:48 
AnswerRe: how to merge or copy one database to another at Midnight every day Pin
loyal ginger9-Nov-09 3:19
loyal ginger9-Nov-09 3:19 
AnswerRe: how to merge or copy one database to another at Midnight every day Pin
loyal ginger9-Nov-09 3:32
loyal ginger9-Nov-09 3:32 
GeneralRe: how to merge or copy one database to another at Midnight every day Pin
It_tech9-Nov-09 23:31
It_tech9-Nov-09 23:31 
GeneralRe: how to merge or copy one database to another at Midnight every day Pin
loyal ginger10-Nov-09 4:24
loyal ginger10-Nov-09 4:24 
GeneralRe: how to merge or copy one database to another at Midnight every day [modified] Pin
It_tech11-Nov-09 1:05
It_tech11-Nov-09 1:05 
Questionselect @@basedir Pin
Davitor8-Nov-09 17:48
Davitor8-Nov-09 17:48 
GeneralWeighted average in T-SQL (like Excel's SUMPRODUCT) Pin
Brady Kelly8-Nov-09 12:48
Brady Kelly8-Nov-09 12:48 
GeneralRe: Weighted average in T-SQL (like Excel's SUMPRODUCT) Pin
Mycroft Holmes8-Nov-09 13:11
professionalMycroft Holmes8-Nov-09 13:11 
GeneralRe: Weighted average in T-SQL (like Excel's SUMPRODUCT) [modified] Pin
Niladri_Biswas8-Nov-09 17:30
Niladri_Biswas8-Nov-09 17:30 
Questionbackp updated row Pin
Fuhrer8-Nov-09 3:40
Fuhrer8-Nov-09 3:40 

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.