copy var contents to the clipboard

  • Thread starter Thread starter Stephen Russell
  • Start date Start date
S

Stephen Russell

I am getting frustrated! I have huge strings in making segments for a SP in
SQL Server. Everything looks good but I want to copy and then past into
ISQL as a test.

this is my error:
Line 1: Incorrect syntax near 'whereclause'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplications(string app, string
whereclause, string paste)
Line 30: {
Line 31: return this.GetDataSet(" exec CopyApps app whereclause paste");
Line 32: }
Line 33:


--
Stephen Russell
S.R. & Associates
Memphis TN

901.246-0159
Steve says get rid of the notat_ to send him a reply!
 
I am getting frustrated! I have huge strings in making segments for a SP in
SQL Server. Everything looks good but I want to copy and then past into
ISQL as a test.

this is my error:
Line 1: Incorrect syntax near 'whereclause'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplications(string app, string
whereclause, string paste)
Line 30: {
Line 31: return this.GetDataSet(" exec CopyApps app whereclause paste");
Line 32: }
Line 33:

First format a string with the *values* of the parameters, not the
names:

string cmd = String.Format("exec CopyApps {0} {1} {2}", app,
whereclause, paste);

Then execute the 'cmd'.

return this.GetDataSet(cmd);
 
This is a copy to a new part function. I am taking a long row in the part
table and changing the first 3 digits of the part #

Well this is the all the code in the click event:
DepapplCL oDepapplCL = (DepapplCL)this.RegisterBizObj(new DepapplCL());

string app, whereclause, paste;

app = "select ap_applpg,[ap_open],[ap_saetyp],
'"+this.MmTextBox1.Text.Trim()+ "' +substring(ap_part,4,10) as
ap_part,[ap_rotate],[ap_pcthi],[ap_pctlo],[ap_pctrv],[ap_adapt],[ap_adaptc],
[ap_studk],[ap_torque],[ap_fill1],[ap_fillc1],[ap_filln1],[ap_fillf1],[ap_fi
ll2],[ap_fillc2],[ap_filln2],[ap_fillf2],[ap_gear],[ap_shaftk],[ap_fill3],[a
p_fillc3],[ap_filln3],[ap_fillf3],[ap_note1],[ap_note2],[ap_note3],[ap_print
us],[ap_printuk],[ap_printau],[ap_source],[ap_code],[ap_lastmod],[ap_lastusr
],[ap_noprint],[ap_gasket],[ap_fnote1],[ap_fnote2] into #t1 from dbo.depappl
where ";


whereclause = " ap_basicmodel = "+lcModel ; // lcmodel is old part
prefix


paste = " go insert into depappl from #t1 go" ;

///

DataSet MyDataSet = oDepapplCL.SetCopyApplications(app, whereclause, paste);

Code in the SetCopyApplications()

public DataSet SetCopyApplications(string app, string whereclause, string
paste)

{

return this.GetDataSet(" exec CopyApps "+app+", "+whereclause+", "+ paste);

}

now CopyApps SP:

CREATE PROCEDURE dbo.CopyApps

@App varchar(2500), @whereClause varchar(2000), @paste varchar(500)
AS -- put this back in the SP

declare @cmd varchar(5000)
SELECT @cmd = @app+@whereClause+@paste
EXEC (@cmd)
GO


--
Stephen Russell
S.R. & Associates
Memphis TN


901.246-0159
Steve says get rid of the notat_ to send him a reply!
 
This is a copy to a new part function. I am taking a long row in the part
table and changing the first 3 digits of the part #

So has your problem been solved?
 
Back
Top