473,386 Members | 2,078 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,386 software developers and data experts.

Deleting dbf records from VB.NET

Hello,

I have a DBF table, connection is okay, can select necessary records and
fill into dataset,
but can't delete and update them, can anyone please help me on how to do
this/

thanks in advance,
Adriano
Dec 26 '05 #1
12 5043
When you say you can't delete, what do you mean? For instance, have you
written the commands and the fields aren't deleting, do you need help
writing the commands, or are you looking for the GUI tools to work and they
aren't? If you can tell me a little more abou tyour situation, I can be of
more help (I hope ;-P)
"Adriano" <ad*****@mail.ru> wrote in message
news:OG*************@TK2MSFTNGP14.phx.gbl...
Hello,

I have a DBF table, connection is okay, can select necessary records and
fill into dataset,
but can't delete and update them, can anyone please help me on how to do
this/

thanks in advance,
Adriano

Dec 26 '05 #2
Hello Ryan,

thanks for your reply,
I'm not looking for GUI tools for deleting, I just want my vb.net DELETE
query to work. When I execute the following query:
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing SAN =
'25107' is not removed. SELECT and INSERT statements work fine.

I have ODBC connection and dataadapter.

Regards,
Adriano
"W.G. Ryan eMVP" <Wi*********@gmail.com> сообщил/сообщила в новостях
следующее: news:O1*************@TK2MSFTNGP15.phx.gbl...
When you say you can't delete, what do you mean? For instance, have you
written the commands and the fields aren't deleting, do you need help
writing the commands, or are you looking for the GUI tools to work and
they aren't? If you can tell me a little more abou tyour situation, I can
be of more help (I hope ;-P)
"Adriano" <ad*****@mail.ru> wrote in message
news:OG*************@TK2MSFTNGP14.phx.gbl...
Hello,

I have a DBF table, connection is okay, can select necessary records and
fill into dataset,
but can't delete and update them, can anyone please help me on how to do
this/

thanks in advance,
Adriano


Dec 26 '05 #3
Hi,

Dont put the tablename in ' '

cmd.CommandText = "DELETE FROM 310705 WHERE SAN = '25107'"
Ken
--------------

"Adriano" <ad*****@mail.ru> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hello Ryan,

thanks for your reply,
I'm not looking for GUI tools for deleting, I just want my vb.net DELETE
query to work. When I execute the following query:
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing SAN =
'25107' is not removed. SELECT and INSERT statements work fine.

I have ODBC connection and dataadapter.

Regards,
Adriano
"W.G. Ryan eMVP" <Wi*********@gmail.com> сообщил/сообщила в новостях
следующее: news:O1*************@TK2MSFTNGP15.phx.gbl...
When you say you can't delete, what do you mean? For instance, have you
written the commands and the fields aren't deleting, do you need help
writing the commands, or are you looking for the GUI tools to work and
they aren't? If you can tell me a little more abou tyour situation, I
can be of more help (I hope ;-P)
"Adriano" <ad*****@mail.ru> wrote in message
news:OG*************@TK2MSFTNGP14.phx.gbl...
Hello,

I have a DBF table, connection is okay, can select necessary records and
fill into dataset,
but can't delete and update them, can anyone please help me on how to do
this/

thanks in advance,
Adriano



Dec 26 '05 #4
Hello Ken,

I tryied without ' ', many other combinations, no result((((

anyone please help me....

Adriano

"Ken Tucker [MVP]" <vb***@bellsouth.net> сообщил/сообщила в новостях
следующее: news:OA**************@TK2MSFTNGP09.phx.gbl...
Hi,

Dont put the tablename in ' '

cmd.CommandText = "DELETE FROM 310705 WHERE SAN = '25107'"
Ken
--------------

"Adriano" <ad*****@mail.ru> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hello Ryan,

thanks for your reply,
I'm not looking for GUI tools for deleting, I just want my vb.net DELETE
query to work. When I execute the following query:
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing SAN
= '25107' is not removed. SELECT and INSERT statements work fine.

I have ODBC connection and dataadapter.

Regards,
Adriano
"W.G. Ryan eMVP" <Wi*********@gmail.com> сообщил/сообщила в новостях
следующее: news:O1*************@TK2MSFTNGP15.phx.gbl...
When you say you can't delete, what do you mean? For instance, have you
written the commands and the fields aren't deleting, do you need help
writing the commands, or are you looking for the GUI tools to work and
they aren't? If you can tell me a little more abou tyour situation, I
can be of more help (I hope ;-P)
"Adriano" <ad*****@mail.ru> wrote in message
news:OG*************@TK2MSFTNGP14.phx.gbl...
Hello,

I have a DBF table, connection is okay, can select necessary records
and fill into dataset,
but can't delete and update them, can anyone please help me on how to
do this/

thanks in advance,
Adriano



Dec 26 '05 #5

try this
cmd.CommandText = "DELETE FROM [310705] WHERE SAN = '25107'"

if SAN is a numeric fiield the syntax is like this

cmd.CommandText = "DELETE FROM [310705] WHERE SAN = 25107"
regards

Michel Posseth [MCP]



"Adriano" <ad*****@mail.ru> wrote in message
news:Om***************@TK2MSFTNGP12.phx.gbl...
Hello Ken,

I tryied without ' ', many other combinations, no result((((

anyone please help me....

Adriano

"Ken Tucker [MVP]" <vb***@bellsouth.net> сообщил/сообщила в новостях
следующее: news:OA**************@TK2MSFTNGP09.phx.gbl...
Hi,

Dont put the tablename in ' '

cmd.CommandText = "DELETE FROM 310705 WHERE SAN = '25107'"
Ken
--------------

"Adriano" <ad*****@mail.ru> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hello Ryan,

thanks for your reply,
I'm not looking for GUI tools for deleting, I just want my vb.net DELETE
query to work. When I execute the following query:
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing SAN
= '25107' is not removed. SELECT and INSERT statements work fine.

I have ODBC connection and dataadapter.

Regards,
Adriano
"W.G. Ryan eMVP" <Wi*********@gmail.com> сообщил/сообщила в новостях
следующее: news:O1*************@TK2MSFTNGP15.phx.gbl...
When you say you can't delete, what do you mean? For instance, have
you written the commands and the fields aren't deleting, do you need
help writing the commands, or are you looking for the GUI tools to work
and they aren't? If you can tell me a little more abou tyour
situation, I can be of more help (I hope ;-P)
"Adriano" <ad*****@mail.ru> wrote in message
news:OG*************@TK2MSFTNGP14.phx.gbl...
> Hello,
>
> I have a DBF table, connection is okay, can select necessary records
> and fill into dataset,
> but can't delete and update them, can anyone please help me on how to
> do this/
>
> thanks in advance,
> Adriano
>



Dec 26 '05 #6
No result((((((

Any other ideas???

thanks in advance
Adriano

"m.posseth" <mi*****@nohausystems.nl> сообщил/сообщила в новостях следующее:
news:eE**************@TK2MSFTNGP09.phx.gbl...

try this
cmd.CommandText = "DELETE FROM [310705] WHERE SAN = '25107'"

if SAN is a numeric fiield the syntax is like this

cmd.CommandText = "DELETE FROM [310705] WHERE SAN = 25107"
regards

Michel Posseth [MCP]



"Adriano" <ad*****@mail.ru> wrote in message
news:Om***************@TK2MSFTNGP12.phx.gbl...
Hello Ken,

I tryied without ' ', many other combinations, no result((((

anyone please help me....

Adriano

"Ken Tucker [MVP]" <vb***@bellsouth.net> сообщил/сообщила в новостях
следующее: news:OA**************@TK2MSFTNGP09.phx.gbl...
Hi,

Dont put the tablename in ' '

cmd.CommandText = "DELETE FROM 310705 WHERE SAN = '25107'"
Ken
--------------

"Adriano" <ad*****@mail.ru> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hello Ryan,

thanks for your reply,
I'm not looking for GUI tools for deleting, I just want my vb.net
DELETE query to work. When I execute the following query:
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing
SAN = '25107' is not removed. SELECT and INSERT statements work fine.

I have ODBC connection and dataadapter.

Regards,
Adriano
"W.G. Ryan eMVP" <Wi*********@gmail.com> сообщил/сообщила в новостях
следующее: news:O1*************@TK2MSFTNGP15.phx.gbl...
> When you say you can't delete, what do you mean? For instance, have
> you written the commands and the fields aren't deleting, do you need
> help writing the commands, or are you looking for the GUI tools to
> work and they aren't? If you can tell me a little more abou tyour
> situation, I can be of more help (I hope ;-P)
> "Adriano" <ad*****@mail.ru> wrote in message
> news:OG*************@TK2MSFTNGP14.phx.gbl...
>> Hello,
>>
>> I have a DBF table, connection is okay, can select necessary records
>> and fill into dataset,
>> but can't delete and update them, can anyone please help me on how to
>> do this/
>>
>> thanks in advance,
>> Adriano
>>
>
>



Dec 27 '05 #7
Hi Adriano,

When you say the rows are not removed, what do you mean? In FoxPro DBFs when
a record is deleted it is only flagged as deleted and not physically removed
from the table until the table is Packed. Packing requires exclusive use of
the table and if done at all is usually performed as part of off-hours
housekeeping routines.

For what it's worth, names of Fox tables do not usually begin with numeric
values, but rather with alpha characters or underscores. However, in my test
in VFP9 I was able to create a table with a name like yours and delete
records successfully both with Delete From 123 and Delete From "123".

--
Cindy Winegarden MSCD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Adriano" <ad*****@mail.ru> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing SAN =
'25107' is not removed. ......

Dec 28 '05 #8
Hello Cindy,

thanks for your reply,
Yes, I mean they're not physically deleted after executing query, I'd
appreciate your help if you send me some code on how to do Packing.
I've attached my DBF file in case you'll need it,

Best regards,
Adriano
"Cindy Winegarden" <ci**************@msn.com> сообщил/сообщила в новостях
следующее: news:ey**************@TK2MSFTNGP12.phx.gbl...
Hi Adriano,

When you say the rows are not removed, what do you mean? In FoxPro DBFs
when
a record is deleted it is only flagged as deleted and not physically
removed
from the table until the table is Packed. Packing requires exclusive use
of
the table and if done at all is usually performed as part of off-hours
housekeeping routines.

For what it's worth, names of Fox tables do not usually begin with numeric
values, but rather with alpha characters or underscores. However, in my
test
in VFP9 I was able to create a table with a name like yours and delete
records successfully both with Delete From 123 and Delete From "123".

--
Cindy Winegarden MSCD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Adriano" <ad*****@mail.ru> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
cmd.CommandText = "DELETE FROM `310705` WHERE SAN = '25107'

there's no error message, it seems okay but actually rows containing SAN
=
'25107' is not removed. ......




Dec 28 '05 #9
Hi Adriano,

Why do you think you need to pack the tables? Most Fox developers run with
Set Deleted On and only pack the tables when doing some sort of
weekly/monthly maintenance. Also, packing tables requires exclusive access
and so it can't be done every time a record is deleted.
'-- VB.NET code to pack a table:
'-- Download and install the latest VFP OLE DB data provider from
'-- http://msdn.microsoft.com/vfoxpro/do.../default.*aspx

Imports System
Imports System.Data.OleDb
Module Module1
Sub Main()
Try
Dim cn As OleDbConnection = New OleDbConnection( _
"Provider=VFPOLEDB.1;Data Source=C:\Temp\;")

Dim cmd As OleDbCommand = New OleDbCommand( _
"Set Exclusive On; Pack Test.dbf", cn)

cn.Open()
cmd.ExecuteNonQuery()
cn.Close()

Catch e As Exception
MsgBox("Exception")
End Try

End Sub
End Module
--
Cindy Winegarden MSCD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Adriano" <ad*****@mail.ru> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
Hello Cindy,

thanks for your reply,
Yes, I mean they're not physically deleted after executing query, I'd
appreciate your help if you send me some code on how to do Packing.

Dec 28 '05 #10

Aha ,, he was using the Fox :-)
Cindy ,, did you made a mistake in your footer ?? or is this a title i do
not know yet "MSCD" should have been MCSD i guess ( Microsoft Certified
Solution`s Developer ) :-)

regards

Michel Posseth [MCP]

"Cindy Winegarden" <ci**************@msn.com> wrote in message
news:Ol****************@TK2MSFTNGP09.phx.gbl...
Hi Adriano,

Why do you think you need to pack the tables? Most Fox developers run with
Set Deleted On and only pack the tables when doing some sort of
weekly/monthly maintenance. Also, packing tables requires exclusive access
and so it can't be done every time a record is deleted.
'-- VB.NET code to pack a table:
'-- Download and install the latest VFP OLE DB data provider from
'-- http://msdn.microsoft.com/vfoxpro/do.../default.*aspx

Imports System
Imports System.Data.OleDb
Module Module1
Sub Main()
Try
Dim cn As OleDbConnection = New OleDbConnection( _
"Provider=VFPOLEDB.1;Data Source=C:\Temp\;")

Dim cmd As OleDbCommand = New OleDbCommand( _
"Set Exclusive On; Pack Test.dbf", cn)

cn.Open()
cmd.ExecuteNonQuery()
cn.Close()

Catch e As Exception
MsgBox("Exception")
End Try

End Sub
End Module
--
Cindy Winegarden MSCD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Adriano" <ad*****@mail.ru> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
Hello Cindy,

thanks for your reply,
Yes, I mean they're not physically deleted after executing query, I'd
appreciate your help if you send me some code on how to do Packing.


Dec 28 '05 #11
Thanks Michel. Some days I just can't type.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"m.posseth" <mi*****@nohausystems.nl> wrote in message
news:e7****************@TK2MSFTNGP10.phx.gbl...
Cindy ,, did you made a mistake in your footer ??

Dec 30 '05 #12

"Adriano" <ad*****@mail.ru> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
No result((((((

Any other ideas???


Do you need a COMMIT statement?

Jan 2 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark | last post by:
This question refers to a main form with a continuous form subform. After an error occurs after entering several records in the subform, how can I delete all the data in the main form and all the...
3
by: Nathan Bloom | last post by:
Hi, I have a data entry form (access 2000) that also allows the user to add, update, and delete records from the form. The Delete action is carried out in an event procedure and has the...
2
by: uv | last post by:
Hi! I'm having problems submitting a new record through the form. I'm working with the wizard and I've added a control button to my form for entering entering a new record but for some reason it...
3
by: Mike Turco | last post by:
I'm working on an application that imports and exports tons of CSV data, like 64,000 records per file, and six or seven files in a set. First off, by the tine I import a few hundred thousand...
1
by: Coy Howe | last post by:
This one seems bizarre! We have a database consisting of a main table and 12 - 15 "sub" tables, which are connected via cascading relationships. The database performs many complex calculations...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
5
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am...
2
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
2
by: padmaneha | last post by:
Hi I have created two tables 'TrainsMaster' & 'TransArrvlDepinfo' Columns which I have created in 'TrainsMaster' are 'trainName,TrainNo, StartStaionId, & EndstationId' Columns which I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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...
0
Oralloy
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,...

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.