By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

copy var contents to the clipboard

P: n/a
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!
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
In article <ud**************@TK2MSFTNGP10.phx.gbl>,
srussell@notat_lotmate.com says...
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);

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #2

P: n/a
In article <ud**************@TK2MSFTNGP10.phx.gbl>,
srussell@notat_lotmate.com says...
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);

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #3

P: n/a
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!

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <ud**************@TK2MSFTNGP10.phx.gbl>,
srussell@notat_lotmate.com says...
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);

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 15 '05 #4

P: n/a
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!

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <ud**************@TK2MSFTNGP10.phx.gbl>,
srussell@notat_lotmate.com says...
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);

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 15 '05 #5

P: n/a
In article <OZ**************@TK2MSFTNGP11.phx.gbl>,
srussell@notat_lotmate.com says...
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?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.