We are trying to get data to a file , which is prepared using “select…for XML”
The code fragment that we are trying is :
filename = "";
filename = txtFolderPath.Text + roww[0].ToString() + ".xml";
SqlParameter[] a = new SqlParameter[1];
a[0] = new SqlParameter("@p_document_no", DbType.String);
a[0].Value = roww[0].ToString();
dtxml = SqlHelper.ExecuteXmlReader(Properties.Settings.Default.ConStr,
CommandType.StoredProcedure, "dbo.PR_GENERATE_INVOICE_XML", a);
the error we get :
Error 3 The best overloaded method match for
‘SqlHelper.ExecuteXmlReader(System.Data.SqlClient.SqlConnection,
System.Data.CommandType, string, params
System.Data.SqlClient.SqlParameter[])’ has some invalid arguments
In the stored procedure, some values are calculated before entering the select portion of the sp so running as sql text command will not produce the desired output.
Any ideas are welcomed
You are not passing in a SqlConnection which is what the method wants, you’re passing a connection string. Use that to create the connection.
try…