Groups > Databases > Oracle for ASP.NET > Re: Not a valid month




Not a valid month

Not a valid month
Tue, 1 Apr 2008 16:56:19 +0000
I am using asp.net with c#. My database is Oracle and i am trying to insert a
datetime.now in my sql statement. However I recieved the error "Not a vaild
month". How can i solve this error.
Post Reply
Re: Not a valid month
Tue, 1 Apr 2008 17:07:54 +0000
why not just make the default value in the database field SYSDATE
Post Reply
Re: Not a valid month
Tue, 1 Apr 2008 17:10:53 +0000
See if this discussion helps you:

http://forums.asp.net/p/1113693/2060186.aspx
Post Reply
Re: Not a valid month
Tue, 1 Apr 2008 17:51:55 +0000
Okay i have tried them all but no luck either. Here is my code see what else i
could do

 publicstaticvoid InsertPrefSearchStudyName()

{string currDate = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"); 

 OracleConnection Conn = newOracleConnection();

Conn.ConnectionString = ConfigurationSection.DbConnectionString;OracleCommand
cmd = newOracleCommand("INSERT INTO table (ID, someotherID, NAME, VALUE,
DATE, BY, MODIFIED, name) VALUES (' " + SessionAccess.ClientUserID + "
', ' " + SessionAccess.ClientID + " ', 'PREF_SRCH_STD_NAME', " +
SessionAccess.StudyNameValue + " , ' " + currDate+ " ', ' "
+ SessionAccess.UserName + " ', ' " + currDate + " ', ' " +
SessionAccess.UserName + " ') ", Conn);cmd.CommandType =
CommandType.Text;

Conn.Open();

cmd.ExecuteNonQuery();

 

Conn.Close();

}

Still getting invalid month at cmd.ExecuteNonQuery()
Post Reply
Re: Not a valid month
Tue, 1 Apr 2008 18:00:18 +0000
make the DATE and MODIFIED fields in the database have a defualt value of
SYSDATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! publicstaticvoid
InsertPrefSearchStudyName()

{string currDate = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss");

OracleConnection Conn = newOracleConnection();Conn.ConnectionString =
ConfigurationSection.DbConnectionString;OracleCommand cmd =
newOracleCommand("INSERT INTO table (ID, someotherID, NAME, VALUE, DATE,
BY, MODIFIED, name) VALUES (' " + SessionAccess.ClientUserID + " ', '
" + SessionAccess.ClientID + " ', 'PREF_SRCH_STD_NAME', " +
SessionAccess.StudyNameValue + " , ' "+ currDate+ " ', ' " +
SessionAccess.UserName + " ', ' " + currDate + " ', ' " +
SessionAccess.UserName + " ') ", Conn);cmd.CommandType =
CommandType.Text;

Conn.Open();

cmd.ExecuteNonQuery();

 

Conn.Close();

}
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact