After entering the sql statement da.deletecomman d.commandtext = "Delete from
Users where username = @username" I set the parameter to the username I wish
to delete.
This successfully deletes the user. However, even if I enter an non-existant
user, I cannot discern whether a user was deleted or not. Is there a way to
do this? (I would rather not use a dataset, since I am trying to increase
performance).
thanks in advance
Rodger Dusatko 4 4620
"Rodger Dusatko" <ro****@dusatko .com> schrieb After entering the sql statement da.deletecomman d.commandtext = "Delete from Users where username = @username" I set the parameter to the username I wish to delete.
This successfully deletes the user. However, even if I enter an non-existant user, I cannot discern whether a user was deleted or not. Is there a way to do this? (I would rather not use a dataset, since I am trying to increase performance).
There's an ADO.Net group for ADO.Net related questions:
microsoft.publi c.dotnet.framew ork.adonet
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Hi Rodger,
Then you want only to do deletecommands, have than a look at the normal
command executecommands http://msdn.microsoft.com/library/de...querytopic.asp
When you have more questions about that I advice you as well to ask it in
the newsgroup Armin did pointed you on.
Cor
Rodger,
Have you looked at the return value from ExecuteNonQuery , it returns the #
of rows affected.
Something like (untested):
Dim deleteCommand As SqlCommand
If deleteCommand.E xecuteNonEquery () = 0 then
MessageBox.Show "User not Deleted"
End If
Hope this helps
Jay
"Rodger Dusatko" <ro****@dusatko .com> wrote in message
news:c9******** *****@news.t-online.com... After entering the sql statement da.deletecomman d.commandtext = "Delete
from Users where username = @username" I set the parameter to the username I
wish to delete.
This successfully deletes the user. However, even if I enter an
non-existant user, I cannot discern whether a user was deleted or not. Is there a way
to do this? (I would rather not use a dataset, since I am trying to increase performance).
thanks in advance
Rodger Dusatko
Thanks! That was the answer.
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schrieb im
Newsbeitrag news:eA******** ******@TK2MSFTN GP12.phx.gbl... Rodger, Have you looked at the return value from ExecuteNonQuery , it returns the # of rows affected.
Something like (untested): Dim deleteCommand As SqlCommand
If deleteCommand.E xecuteNonEquery () = 0 then MessageBox.Show "User not Deleted" End If
Hope this helps Jay
"Rodger Dusatko" <ro****@dusatko .com> wrote in message news:c9******** *****@news.t-online.com... After entering the sql statement da.deletecomman d.commandtext = "Delete from Users where username = @username" I set the parameter to the username I wish to delete.
This successfully deletes the user. However, even if I enter an non-existant user, I cannot discern whether a user was deleted or not. Is there a way to do this? (I would rather not use a dataset, since I am trying to
increase performance).
thanks in advance
Rodger Dusatko
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike |
last post by:
I know this sounds strange but I am at a loss. I am calling a simple
funtion that opens a connection to a SQL Server 2000 database and executes
an Insert Statement.
private void AddMinimunWageStipen(string payrollid,double amount)
{
System.Data.SqlClient.SqlConnection cn = null;
System.Data.SqlClient.SqlCommand cm = null;
|
by: Peter Afonin |
last post by:
Hello:
I'm deleteing data using Datagrid, then rebind it. For some reason
ItemDataBound event doesn't fire after DeleteCommand. Why is this? Is it by
design, or I'm missing something? I have some important calculations in
ItemDataBound event. My code for DeleteCommand is below.
I would appreciate your help very much.
Private Sub...
|
by: jdb |
last post by:
Hi,
I am adding a record to the database using an ExecuteNonQuery, which adds
without problem. Now after the record is added I run a method passing in
some info as well as the curretnly opened connection (byRef cn as
OleDbConnection). Am using an Access 2000 database. Now in this new method I
create a command object using the passed in...
|
by: Nathan Sokalski |
last post by:
I have a DataList that has an Button as one of the controls in it's
ItemTemplate. The Button has a CommandName="delete" attribute, but when I
click it the DeleteCommand event doesn't even get fired. I have checked
everything I could think of, but everything looks correct to me. Here is the
relevant code from the *.aspx file and the *.aspx.vb...
|
by: Averell |
last post by:
Hi,
I made a gridview with VWD. The gridview has the Delete button set
(ShowDeleteButton="True" in the <asp:CommandField>).
It works perfect, but i would like to add a warning before the record is
deleted to prevent deleting a wrong record.
I did this in the code-behind file:
Protected Sub GridView1_RowDeleting(ByVal sender As Object,...
| |
by: sherifffruitfly |
last post by:
Hi,
I'm deleting a bunch of records from my DB, and they actually DO get
deleted (as I verify by looking afterwards). But then I get the
exception in the subject line. Isn't it weird that all of the correct
records would get deleted, and only *after* that, an error gets thrown?
Here's the code I'm using - thanks for any ideas!
try
|
by: DanG |
last post by:
I do not want to delete the row from the database when the user clicks
"delete" on the datagrid. I want to mark the dataset record as
deleted, and let the DataAdapter call the delete sproc when the "save"
button is clicked.
In the datagrid1_deletecommand function, .NET returns e.item, which
points to the DATAGRID row. How do I get a...
|
by: renatois |
last post by:
DeleteCommand in SqlDataSource using DetailsView
Hi guys,
Figure that:
- I have two related tables by IDName:
1 - table Name (fields: IDName, Name)
2 - table Products (fields: IDProduct, IDName, Product)
On the page I have a DetailsView for inserting data on table Name and a GridView for editing and deleting records. In table Name,...
|
by: bogdan |
last post by:
Hi,
I have a stored procedure that deletes a record in db. I created a DataSet
(xsd) which auto-generated code for a table adapter. The adapter's select,
insert, update, and delete methods work fine except for one 'minor' problem
with Delete(). The method returns -1 although it does the job - i.e.
deletes a record from database.
Could...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |