Hi,
Me again. I want to create a SQL Server StoreProcedure and I want to access
it with ADO.NET. I am using VB.NET.
Creating StoreProcedure it was easy but my question is this.
I have table with 4 Column and 6 rows. In the Column 3 for all rows I have
to insert data. The data considt of the decimal value of Croiss Exchange and
6 my variable as:
mUSD = 1.33500
mAUD = 0.91841
mSTG = 2.39300
mJPY = 0.01068
mEuro = 1.63900
mCYP = 2.85700
My Stored Procudure I have to use the CurrncyId as
USD = 1
AUD = 2
STG = 3
JPY = 4
Euro = 5
CYP = 6
Now if I create a Stored Procedure as:
"INSERT INTO tbl_DAILYRATE(x CHANGE) VALUES (@mUSD) WHERE cCHANHEID = USD"
and try to insert data into SQL Server I am getting error that says my
Stored Procedure string has error.
Does anyone know how to Create a Stored procedure to Insert data using some
column as ID Key?
Thank you in advance.
Rgds.
GC 3 2482
Niyazi,
If you use the SQL, Oracle or OleDBDataadapte r in your toolbox, than a
wizard is started.
The most simple is to add as item a component. Drag one of above to your
component and the wizard starts and at the end it to create all your
command. Than you open the generated code in the component and all your code
is there.
Another way, not forever save with complex query string are the
commandbuilders http://msdn.microsoft.com/library/de...classtopic.asp
Did you know that there is in fact a better newsgroup for this kind of
questions.
microsoft.publi c.dotnet.framew ork.adonet
I hope this helps,
Cor
Hi Cor,
Sorry I didn't realize that I was in wrong group.
I find the answere as follows:
Here is my SQL Server Stored Procedure that updates 1 column using WHERE
clause
CREATE PROCEDURE UPDATE_DAILYRAT E
@mNO int,
@mCUR nvarchar (7)
AS
Update tblRATE SET mCurrency = @mCUR WHERE mCurrencyType = @mNO
GO
+++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++
And here is my VB.NET code that calls the above Stored Procedure and insert
the value into specific column and row
+++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++
Try
Dim connectionSQLSE RVER As New SqlConnection(s trConnSQLSERVER )
cn = connectionSQLSE RVER
'INSERT USD CROSS EXCHANGE
Dim cmdUSD As New SqlCommand("UPD ATE_DAILYRATE", cn)
cmdUSD.CommandT ype = CommandType.Sto redProcedure
Dim ParamColl As SqlParameterCol lection = cmdUSD.Paramete rs
Dim mUSDNO As Integer = 1
Dim mNO As Integer
mNO = mUSDNO
Dim paramDOVIZCINSI As SqlParameter = ParamColl.Add(" @mNO", mNO)
paramDOVIZCINSI .Direction = ParameterDirect ion.Input
Dim mCUR As Decimal = mUSD
Dim paramDOVIZKURU As SqlParameter = ParamColl.Add(" @mCUR", mCUR)
paramDOVIZKURU. Direction = ParameterDirect ion.Input
cn.Open()
cmdUSD.ExecuteN onQuery()
'Clear the variable
ParamColl.Clear ()
mNO = 0
mCUR = 0
paramDOVIZCINSI = Nothing
paramDOVIZKURU = Nothing
cn.Close()
Catch ex As Exception
msgErrorUSD = ex.Message.ToSt ring
End Try
I hope this helps others as well.
Again thank you very much your kind input.
Rgds,
GC
Niyazi,
You are *not* in the wrong group (you never can be in my opinon in one as
long as you don't know the other ones), however there are in my opinon
betters and therefore there is not any reason to say "Sorry" for that.
I am glad that you did succeed.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Sikorsky |
last post by:
How can I get the recordset attributes for a table field in SQL Server 2000
to report the field updatable attribute correctly ... mine keeps saying the
fields are not updatable? That is, ( oRecordSet ( oItem ).Attributes & 0x4)
is always 0 for every field on SQL Server 2000
Example code:
var sSQL = 'SELECT TOP 1 * FROM WHERE ' + sUniqueField
+ '=' + sUniqueValue + ';';
|
by: Bercin Ates via SQLMonster.com |
last post by:
I?m getting an error when I execute a stored procedure which is try to insert a row to a table.
The error is:
Server: Msg 1934, Level 16, State 1, Procedure SRV_SP_IS_EMRI_SATIRI_EKLE, Line 32
INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS.'.
In my sp, I insert an row to a table. But also I created a view which is select some fields from this table.
(Note: Some fields are calculated fields in this...
|
by: Jegg |
last post by:
I wrote a web app using an ASP front end (not .NET) connecting to a SQL
Server 2000 (no SP) back end. Both the web server and the database
server are Windows 2003 boxes. The app was running fine two weeks ago
before I went on vacation. While I was gone my net admin applied
Windows 2003 SP1 to the web server. Upon my return I was informed that
the app is no longer working, getting the following error:
Connection is busy with results...
|
by: Niyazi |
last post by:
Hi,
Me again. I want to create a SQL Server StoreProcedure and I want to access
it with ADO.NET. I am using VB.NET.
Creating StoreProcedure it was easy but my question is this.
I have table with 4 Column and 6 rows. In the Column 3 for all rows I have
to insert data. The data considt of the decimal value of Croiss Exchange and
6 my variable as:
|
by: James Wong |
last post by:
Hi,
I am writing a vb.net2005 program that needs to create a stored procedure
with SqlServerProject Template.
Now, I have two questions for this stored procedure.
1) How can I import and execute the .dll in this Stored Procedures?
2) How can I connect the Web Service and get the result in this Stored
Procedures?
| |
by: den 2005 |
last post by:
Hi everybody,
I created several stored procedure in a local sql server 2005 express
database, now when I call/execute them in the asp.net 2.0 web page, it
returns an error message of "Cannot find the stored procedure '<proc_name>'",
this is funny, when I execute the command in a sql query window "exec
sp_GetAllArticles", it also returns cannot find stored procedure, but when I
execute the "Use <DBName>" and then execute the statement, it...
|
by: rn5a |
last post by:
Suppose a SQL Server 2005 stored procedure looks like this:
ALTER PROCEDURE SPName
@UserID int
SELECT COUNT(*) FROM Table1 WHERE UserID = @UserID
SELECT COUNT(*) FROM Table1
In the ASPX page, I can get the result of the first query in the above
SP using
|
by: scparker |
last post by:
Hello,
We have a stored procedure that does a basic insert of values. I am
then able to retrieve the ID number created for this new record. We are
currently using ASP.NET 2.0 and use N-Tier Architecture.
The Stored Procedures are used through TableAdaptors, which in turn are
used by Class Files.
I wish to be able to return this new ID value using the Stored
|
by: Neil |
last post by:
I'm using Access 2000 with a SQL 7 back end. I recently implemented some
code in a form's AfterUpdate event which calls a stored procedure which
copies the contents of the current record to a history table. The code works
fine when the user edits and saves the record. However, if the user performs
a Find and Replace, the code hangs.
At first I thought the code was hanging because of multiple records being
replaced. But when I debugged...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |