Click here to Skip to main content
15,912,756 members
Home / Discussions / C#
   

C#

 
QuestionConfigurationException and ConfigurationErrorException Pin
Dan Neely14-May-09 10:18
Dan Neely14-May-09 10:18 
AnswerRe: ConfigurationException and ConfigurationErrorException Pin
Dan Neely14-May-09 14:10
Dan Neely14-May-09 14:10 
QuestionHow to add Admin creds to my program ? Pin
partialdata14-May-09 10:14
partialdata14-May-09 10:14 
QuestionClick Once & Application Cache Pin
BlitzPackage14-May-09 9:46
BlitzPackage14-May-09 9:46 
AnswerRe: Click Once & Application Cache Pin
Graeme Bosworth26-Apr-10 20:35
Graeme Bosworth26-Apr-10 20:35 
Questionhelp Pin
Alex_xso14-May-09 9:23
Alex_xso14-May-09 9:23 
AnswerRe: help Pin
Anthony Mushrow14-May-09 9:32
professionalAnthony Mushrow14-May-09 9:32 
QuestionError 170:In correct Syntax- SQL Server and C# Pin
SilimSayo14-May-09 8:22
SilimSayo14-May-09 8:22 
I am trying to call a stored procedure from C#. The stored procedure, called create_journal, compiles succesfully on SQL Server and also runs sucessfully when executed in query analyzeer. It takes a datetime input parameter. When I call it from C#, I get an SqlException which says Error 170. Line 1 Incorrect syntax near create_journal_entry
The stored Procedure begins as follows

ALTER       PROCEDURE create_journal_entry
@eom_date DATETIME --End of month date
AS

DECLARE

@next_jrnl_num VARCHAR(20)


The c# code is
private void createJEs()
{
	DateTime cutOffDate;
	cutOffDate=this.dtpCutOffDate.Value;

	SqlConnection conn =new SqlConnection(DBConnection.connectionString());
	conn.Open();
	SqlCommand comm=new SqlCommand("create_journal_entry",conn);
        comm.Parameters.Add("@eom_date",SqlDbtype.DateTime);
        comm.parameters["@eom_date"].value=this.dtpCutOffDate.Value;
	
        try
	{
		comm.ExecuteNonQuery();	
		moveFiles();
                MessageBox.Show("Data has been successfully sent to the   
                GL.", "Success",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
	}
	catch(SqlException ex)
	{
            MessageBox.Show("Error "+ex.Number + " "+ ex.Message,"SqlServer 
            error",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
	}
	catch(Exception ex)
	{
            MessageBox.Show(ex.Message,"System Error",  
            MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
	}
	finally
	{
		if (conn!=null)
		{
			conn.Close();
		}
	}
}


NB this.dtpCutOffDate is a DateTime picker control.

Please help as I am going nuts over this.

Thanks
AnswerRe: Error 170:In correct Syntax- SQL Server and C# Pin
Ian McCaul14-May-09 8:28
Ian McCaul14-May-09 8:28 
GeneralRe: Error 170:In correct Syntax- SQL Server and C# Pin
SilimSayo14-May-09 8:47
SilimSayo14-May-09 8:47 
QuestionMonitor a text file to see when it opens or closes... Pin
Engineer Joe14-May-09 7:48
Engineer Joe14-May-09 7:48 
AnswerRe: Monitor a text file to see when it opens or closes... Pin
DaveyM6914-May-09 7:59
professionalDaveyM6914-May-09 7:59 
AnswerRe: Monitor a text file to see when it opens or closes... Pin
Baeltazor14-May-09 8:04
Baeltazor14-May-09 8:04 
AnswerRe: Monitor a text file to see when it opens or closes... Pin
Engineer Joe14-May-09 8:12
Engineer Joe14-May-09 8:12 
GeneralRe: Monitor a text file to see when it opens or closes... Pin
DaveyM6914-May-09 8:25
professionalDaveyM6914-May-09 8:25 
QuestionC# Direct3D Question Pin
will kirkby14-May-09 7:30
will kirkby14-May-09 7:30 
AnswerRe: C# Direct3D Question Pin
Anthony Mushrow14-May-09 14:01
professionalAnthony Mushrow14-May-09 14:01 
QuestionCustom Control Pin
jammmie99914-May-09 7:11
professionaljammmie99914-May-09 7:11 
AnswerRe: Custom Control Pin
DaveyM6914-May-09 7:26
professionalDaveyM6914-May-09 7:26 
GeneralRe: Custom Control Pin
jammmie99914-May-09 8:37
professionaljammmie99914-May-09 8:37 
Questiondatagrid add column Pin
michaelgr114-May-09 6:42
michaelgr114-May-09 6:42 
QuestionProblem to workflow Pin
hdv21214-May-09 6:29
hdv21214-May-09 6:29 
AnswerRe: Problem to workflow Pin
DaveyM6914-May-09 9:06
professionalDaveyM6914-May-09 9:06 
GeneralRe: Problem to workflow Pin
hdv21214-May-09 9:37
hdv21214-May-09 9:37 
QuestionTab to previous control not working. Pin
lastdays14-May-09 6:22
lastdays14-May-09 6:22 

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.