Hi,
I want to check whether the record exist or not based on my query, so i'll
be using OleDbCommand.
What is the best way to check on a huge table ? I used to write like this in
VB6.0...
---------------------------------------------------
Public Function SaveOrUpdate() As Boolean
sSQL = "SELECT * FROM AdmAllergy WHERE " & _
" CompanyCode = " & mQuotedStr(mCom panyCode) & _
" AND BranchCode = " & mQuotedStr(mBra nchCode) & _
" AND Code = " & mQuotedStr(sCod e)
Set oRs = TmpAdoSet(sSQL)
With oRs
If .EOF And .BOF Then
.AddNew
.Fields("Compan yCode") = Trim(mCompanyCo de)
.Fields("Branch Code") = Trim(mBranchCod e)
.Fields("Code") = Trim(sCode)
.Fields("Create dBy") = Trim(mUserId)
Else
.Fields("Edited By") = Trim(mUserId)
.Fields("Edited Date") = Format(Now, "yyyy-mm-dd hh:mm:ss")
End If
.Fields("Name") = Trim(Name)
.UpdateBatch
.Close
End With
SaveOrUpdate = True
Set oRs = Nothing
End Function
---------------------------------------------------
So, how do i write in VB.Net ? Want to open check record exist or not. If
exist then update other fields
or else add new record. I prefer to use OleDbCommand.
Any Help ?
Regards 6 21928
Hi,
I want to check whether the record exist or not based on my query, so i'll
be using OleDbCommand.
What is the best way to check on a huge table ? I used to write like this in
VB6.0...
---------------------------------------------------
Public Function SaveOrUpdate() As Boolean
sSQL = "SELECT * FROM AdmAllergy WHERE " & _
" CompanyCode = " & mQuotedStr(mCom panyCode) & _
" AND BranchCode = " & mQuotedStr(mBra nchCode) & _
" AND Code = " & mQuotedStr(sCod e)
Set oRs = TmpAdoSet(sSQL)
With oRs
If .EOF And .BOF Then
.AddNew
.Fields("Compan yCode") = Trim(mCompanyCo de)
.Fields("Branch Code") = Trim(mBranchCod e)
.Fields("Code") = Trim(sCode)
.Fields("Create dBy") = Trim(mUserId)
Else
.Fields("Edited By") = Trim(mUserId)
.Fields("Edited Date") = Format(Now, "yyyy-mm-dd hh:mm:ss")
End If
.Fields("Name") = Trim(Name)
.UpdateBatch
.Close
End With
SaveOrUpdate = True
Set oRs = Nothing
End Function
---------------------------------------------------
So, how do i write in VB.Net ? Want to open check record exist or not. If
exist then update other fields
or else add new record. I prefer to use OleDbCommand.
Any Help ?
Regards
=============== ======
Clock's wrong
=============== ======
Hi Itsme,
I think there are many ways, that depends on the way you use ADO.net.
The code you are now using is probably ado 2.6 or something.
In VB.net is used Ado.net it is a totaly different approach.
"Datasets, dataview, datarows and no recordsets."
I think that the best place to ask a question like this is in the
public dotnet adonet newsgroup.
I hope you have success
Cor
Thanks cor,
i've done that. desperately waiting for an answer
Regards
"Cor" <no*@non.com> wrote in message
news:3f******** **************@ reader22.wxs.nl ... Hi Itsme, I think there are many ways, that depends on the way you use ADO.net. The code you are now using is probably ado 2.6 or something. In VB.net is used Ado.net it is a totaly different approach. "Datasets, dataview, datarows and no recordsets."
I think that the best place to ask a question like this is in the public dotnet adonet newsgroup.
I hope you have success Cor
try desperately setting your system clock back to normal time.
"ItsMe" <it*******@yaho o.com> wrote in message
news:OM******** ******@TK2MSFTN GP09.phx.gbl...
Thanks cor,
i've done that. desperately waiting for an answer
Regards
"Cor" <no*@non.com> wrote in message
news:3f******** **************@ reader22.wxs.nl ... Hi Itsme, I think there are many ways, that depends on the way you use ADO.net. The code you are now using is probably ado 2.6 or something. In VB.net is used Ado.net it is a totaly different approach. "Datasets, dataview, datarows and no recordsets."
I think that the best place to ask a question like this is in the public dotnet adonet newsgroup.
I hope you have success Cor
Use OleDBCommand.Ex ecuteScalar and query the count. If the count of your
query is non-zero, it means the record exists. Then use
OleDbCommand.Ex ecuteNonQuery to insert a new record.
Alternatively, use DataSets !! Well, I would recommend that you first
understand ADO.Net before you embark on using it. It is different from
ADO2.7 by quite a margin both in architecture and style of programming and
needs special attention.
"Daniel Bass" <da********@NOS PAMpostmaster.c o.uk> wrote in message
news:OD******** ******@TK2MSFTN GP09.phx.gbl... try desperately setting your system clock back to normal time.
"ItsMe" <it*******@yaho o.com> wrote in message news:OM******** ******@TK2MSFTN GP09.phx.gbl... Thanks cor, i've done that. desperately waiting for an answer
Regards
"Cor" <no*@non.com> wrote in message news:3f******** **************@ reader22.wxs.nl ... Hi Itsme, I think there are many ways, that depends on the way you use ADO.net. The code you are now using is probably ado 2.6 or something. In VB.net is used Ado.net it is a totaly different approach. "Datasets, dataview, datarows and no recordsets."
I think that the best place to ask a question like this is in the public dotnet adonet newsgroup.
I hope you have success Cor
Besides using datasets as previiously mentioned, (which are quite helpful
and reflect that of ADO 2.x's Recordset Object) learn to use Enumerations
within datasets as well. You'll find your development time is cut down
(especially with typed datasets) when you use things like for each
statements, which will be helpful to you in more ways than you know.
Also, the dataset object (generated or not) exposes a ton of properties that
can do every concievable thing you want, including DataRelationshi ps which I
think are one of the most powerful tools you can have.
Hope it helps,
CJ
"ItsMe" <it*******@yaho o.com> wrote in message
news:OM******** ******@TK2MSFTN GP09.phx.gbl... Thanks cor, i've done that. desperately waiting for an answer
Regards
"Cor" <no*@non.com> wrote in message news:3f******** **************@ reader22.wxs.nl ... Hi Itsme, I think there are many ways, that depends on the way you use ADO.net. The code you are now using is probably ado 2.6 or something. In VB.net is used Ado.net it is a totaly different approach. "Datasets, dataview, datarows and no recordsets."
I think that the best place to ask a question like this is in the public dotnet adonet newsgroup.
I hope you have success Cor
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Craig Bailey |
last post by:
Someone please explain what alternate universe I fell into this
afternoon when PHP started telling me that 2 doesn't equal 2.
Not sure about you, but when I run this, it tells me 59001.31 doesn't
equal 59001.31. Change each side of the equation by a hundreth or two
and it checks. Change it a bit more, and it won't.
_What_ is going on here?!
<?php
|
by: Askari |
last post by:
Hi,
How do for do a "select()" on a CheckButton in a menu (make with
add_checkbutton(....) )?
I can modify title, state, etc but not the "check state". :-(
Askari
|
by: Edward |
last post by:
The following html / javascript code produces a simple form with check
boxes. There is also a checkbox that 'checks all' form checkboxes
hotmail style:
<html>
<head>
<title></title>
</head>
<body>
<form name="myform" action=test.php method=post>
|
by: Tony Johnson |
last post by:
Can you make a check box very big? It seems like when you drag it
bigger the little check is still the same size.
Thank you,
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
|
by: Travis.Box |
last post by:
I have an MS Access userform with 16 Check Boxes. Each of the
checkboxes has a different option value, which coincides with the Check
Box name (eg. cb01.OptionValue = 1). At the bottom of the form is a
command button. When the command button is clicked, I need the VBA
scripting to determine which Check Box has been selected, and then
assign a vaule to a string based on which Check Box has been selected.
What I'm having trouble figuring...
| |
by: scprosportsman |
last post by:
Please help guys, i am trying to set up a database here at work and im
fairly new to access in terms of writing functions and queries and
stuff. I have 2 different places on my design that will require
checking a check box to tell which category something will pertain to.
Well after each record is entered i want the check to remain with that
record and auto clear when going to the next record so i can input
something else if i have a...
|
by: Chris Davoli |
last post by:
How do you enable a check box in the GridView. I selected Checkbox Field in
the Columns of the GridView, and the check box shows up in the Grid view, but
it is disabled. How do I enable it so I can check/uncheck it. Also, what
event do I use to check it for a value? Any articles out there?
--
Chris Davoli
|
by: Brian Tkatch |
last post by:
Is there a way to check the order in which SET INTEGRITY needs to be
applied? This would be for a script with a dynamic list of TABLEs.
B.
|
by: starke1120 |
last post by:
Im creating a check in – check out database for RF guns. I have a
table that contains models.
ID (primary key)
Model
A table that contains Gun Details
ID (primary key)
Model_id
Gun_Number (assigned gun number by operations)
|
by: ghjk |
last post by:
my php page has 7 check boxes. I stored checked values to database and retrive as binary values. This is the result array
Array ( => 0 => 1 => 0 => 1 => 0 => 0 => 1 )
1 means checked. I want to display these results in check boxes. This is my code. But it doesn't work
<tr><td><input value="1" type="checkbox" id="1" name="check" <?php if ($array==1) echo "value=checked";?>/>Fasting 6 hours</td>
<td><input value="2"...
|
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: 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...
|
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: 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: 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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |