473,734 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplicat ions(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 2047
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.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplicat ions(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.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplicat ions(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.MmTextB ox1.Text.Trim() + "' +substring(ap_p art,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.SetC opyApplications (app, whereclause, paste);

Code in the SetCopyApplicat ions()

public DataSet SetCopyApplicat ions(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+@whereClau se+@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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
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.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplicat ions(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.MmTextB ox1.Text.Trim() + "' +substring(ap_p art,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.SetC opyApplications (app, whereclause, paste);

Code in the SetCopyApplicat ions()

public DataSet SetCopyApplicat ions(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+@whereClau se+@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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
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.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near 'whereclause'.

Source Error:

Line 29: public DataSet SetCopyApplicat ions(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
10474
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 field, and it works. But, it seems wrong since I had to create a huge text box to accommodate memo fields with a lot of text. Thanks for any help, ShyGuy
3
3309
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 output one of Stephen Lebans' RTF2 controls on the report. He indicates that a copy and paste method will work from a form to the Word doc and that is fine although I have not done this in VB, rather used ^C and ^V I suspect that a similar method...
9
4651
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 with same. Instead, they (heavy spreadsheet users...) want to "Copy and Paste" financial return percentages for various funds into the DB. The source of these copies may be ascii text...but it's also likely to be an Excel spreadsheet on occasion.
1
3114
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 requiring opening each document and deleting the current header and pasting the new one. I have tried to use IncludeText to do this and having the header in a file, but it appears that the client must open each letter and refresh the link before...
5
21028
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 windows explorer: when you do a right-click on a file and choose Copy, and than paste it somewhere in my application and vice versa.
7
11632
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 is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
0
2663
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 panel.There are two viewing preferences available: to view the image with scrollbars (the original image unsized), and to view the iamge without scrollbars (the image resized to fit within the panel's viewing range.) When I resize the image so that...
6
9653
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 adds Cut copy and paste commands, this functionality no longer works. It seems now I need to implement handlers for these functions. I tried to do so, but say the paste handler, I need to call paste on a specific control and that isn't necessarily...
17
5127
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 about 20 textboxes on the form). Also to ensure that the button can't get used if the cursor isn't in a textbox field. And to ensure the contents of the clipboard are "text" contents that have been cut/copied from one of the textboxes on the form. ...
3
7304
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 the following error below. i just keep executing until it works. i'm getting the following error:
0
8946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.