473,395 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

copy var contents to the clipboard

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
5 1999
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo...
3
by: Phil Stanton | last post by:
I am trying to produce a program that will output any Access report to an editable Word document. So far it is working well but slowly with text boxes, labels, and lines. I now need to try to...
9
by: (Pete Cresswell) | last post by:
I see this coming on a develpment effort that may materialize shortly. These guys don't want to mess around with automated imports from text feeds BC in the past they've had too many problems...
1
by: dixie | last post by:
I am doing a job where I need to copy a letter header into each of about 100 letters which are mail merge template documents for about 20 different customers - all up about 2000 copy and pastes...
5
by: DraguVaso | last post by:
Hi, I'm looking for a way to Copy and Paste Files to the clipboard. I found a lot of articles to copy pieces of text and bitmaps etc, but nog whole files. Whay I need is like you have in...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
0
by: mhospodarsky | last post by:
Hi-- I am using VB.Net 2002 for this app. I am working with Tiff and jpeg images. I have a picturebox set up that I use to view the images. I have the picture box inside of a scrollable...
6
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
17
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have...
3
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i'm using the following in my console app: My.Computer.Clipboard.SetText(sb.ToString()) i'm getting inconsistent results with the copy. sometimes it works and most of the time i get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.