473,547 Members | 2,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem on INSERTING a record to database using typed datasets

Dear All,
I have problem on inserting a record to database..Altho ugh it looked
easy.. i have caught up with following issue .. please go ahead and
help me to find solution

I Need to insert records to a data base,for which i am using Typed
dataSet.(I used DataSet Designer to create one)
Then created a table adapter in which i have written query for
INSERT , & set Database Direct property to true.(I didnt use a
seperate methods for INSERT,instead used inbuilt )

query......>INS ERT INTO TABLE1 (NAME,CITY) VALUES (?,?)

Then in My .Vb file i called this method as
Adapter1.Insert ("Value1",Value 2").. before that
i used Adapter1.connec tion.open() and Adapter1.connec tion.close after
that insert ., explicitly.
For the Insert button coding...

Although it compiles and executes Fine .. record is not inserted.to
database Please clarify what I have been missing

I am using Visual studio 2005 & Access 2003

Thanks in advance,

Surya

Sep 22 '07 #1
3 3344
This issue may have to do with the way you set up your Access data source.

See the article at:

http://getdotnetco.web119.discountas...ccessPart1.htm

In the article see item 'z.' that discusses the MDB property 'Copy to Output
Directory'.

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Surya" <su************ *@gmail.comwrot e in message
news:11******** **************@ y42g2000hsy.goo glegroups.com.. .
Dear All,
I have problem on inserting a record to database..Altho ugh it looked
easy.. i have caught up with following issue .. please go ahead and
help me to find solution

I Need to insert records to a data base,for which i am using Typed
dataSet.(I used DataSet Designer to create one)
Then created a table adapter in which i have written query for
INSERT , & set Database Direct property to true.(I didnt use a
seperate methods for INSERT,instead used inbuilt )

query......>INS ERT INTO TABLE1 (NAME,CITY) VALUES (?,?)

Then in My .Vb file i called this method as
Adapter1.Insert ("Value1",Value 2").. before that
i used Adapter1.connec tion.open() and Adapter1.connec tion.close after
that insert ., explicitly.
For the Insert button coding...

Although it compiles and executes Fine .. record is not inserted.to
database Please clarify what I have been missing

I am using Visual studio 2005 & Access 2003

Thanks in advance,

Surya

Sep 22 '07 #2
Surya,

I don't see you using the DataAdapter.Upd ate command, am I right or did you
not show it?

Cor

"Surya" <su************ *@gmail.comschr eef in bericht
news:11******** **************@ y42g2000hsy.goo glegroups.com.. .
Dear All,
I have problem on inserting a record to database..Altho ugh it looked
easy.. i have caught up with following issue .. please go ahead and
help me to find solution

I Need to insert records to a data base,for which i am using Typed
dataSet.(I used DataSet Designer to create one)
Then created a table adapter in which i have written query for
INSERT , & set Database Direct property to true.(I didnt use a
seperate methods for INSERT,instead used inbuilt )

query......>INS ERT INTO TABLE1 (NAME,CITY) VALUES (?,?)

Then in My .Vb file i called this method as
Adapter1.Insert ("Value1",Value 2").. before that
i used Adapter1.connec tion.open() and Adapter1.connec tion.close after
that insert ., explicitly.
For the Insert button coding...

Although it compiles and executes Fine .. record is not inserted.to
database Please clarify what I have been missing

I am using Visual studio 2005 & Access 2003

Thanks in advance,

Surya
Sep 22 '07 #3
Hi Mike,Cor
Thanks for spending your time on me.. I had found where i was wrong &
your suggestions were useful, also got idea from another forum ,

Cor , I was using Insert method generated from table adapter
directly(& i set Generate DBDirect Property to true) so no need of
using update command while Inserting

Actual problem was ------I was inserting data to local file & not to
the original database file
Normally when we add a table adapter through DataSet designer in VS
2005 it prompts "Local database file dialog box" at the end ..

Following link helped me

http://msdn2.microsoft.com/en-us/library/ms246989.aspx

Excerpts from the link :

To respond to the Local database file dialog box

Click Yes if you want Visual Studio to copy the database file into
your project and modify the connection to point to the copy in your
project. For more information on working with database files in your
project, see Local Data Overview.

Click No if you do not want Visual Studio to copy the database file
into your project. Instead, the connection points to the file in the
original location.

Thank you,
Surya

Sep 23 '07 #4

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

Similar topics

3
3283
by: Reney | last post by:
I haven't used the VS Studio's drag&drop method to create my connection, adapters and datasets, but I typed them all. The situation is like this: There is a listbox with members pulled from the database.(I am using an access db). The user selects one value from the listbox and clicks on one of two buttons "ThisWeek" or "LastWeek". The button...
6
3128
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key identifier, I would like a dropdown combo box (lookup from the "order_type" table) to change the type of the order. I also need an update command...
4
1322
by: thebison | last post by:
Hi all, I hope someone can help with this relatively simple problem. I am building a timesheet application using ASP.NET C# with Visual Studio 2003.As it is only a protoype application, my database has been made in MSDE. I have a 'Create Resource' page where new employees are added to the database. On my data-entry form I capture all the...
7
1783
by: Bob | last post by:
Hi, I have a typed unbound dataset that is passed to a datahandling class to be filled. The datahandling class fills it from a sproc using an oledbDataAdapter (SQLAnywhere database) The only table in the dataset has two int32 columns. There is one row of data and as expected, column 0 contains an int and column 1 contains a null. I want to...
2
1353
by: keithb | last post by:
Is there any way to directly access a DataTable record, or is sequential access the only way? Does having a foreign key contraint between parent and child DataTables in any way facilitate accessing child table records? Thanks, Keith
1
2034
by: Magnus | last post by:
I have a set of typed datasets that are tied to a database on a mssql2005 server. They are naturally displayed and available in the DataSources window. Now I want to rename the database, but when I do that and reconfigure any of the datasets with the Wizard, all the datatables I have previously selected are marked as unavailable (with a red x...
1
1722
by: Ivan Sammut | last post by:
I have an asp webpage on which I have a dropdownlist which I fill from my database using Datasets. Now I want to add an empty record in the dataset so the first option of the list is empty but I can only append a record at the end of the Dataset. Any one has an idea on how I can achieve to append a record at the top of my dataset. Thanks...
12
4122
by: Simon | last post by:
Hi all, I'm having a baffling problem with a windows service that I'm working on. Basically, I am using a typed dataset to insert a large number of rows into an SQL Server 2005 database. But there's a memory leak that seems to be to do with calling the data adapters update method. It's making the memory usage go through the roof and...
12
2085
by: =?Utf-8?B?Smlt?= | last post by:
I have code that reads and parses a text file using a schema.ini file. Works great. When I see the dataGrid it's exactly what I want. Dim CString As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\;" & _ "Extended Properties=""text;HDR=No;""" Dim TConnect As New System.Data.OleDb.OleDbConnection(CString)
0
7510
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...
0
7437
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7703
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, 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. ...
0
7947
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...
1
7463
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...
0
7797
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...
0
6032
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...
0
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
748
bsmnconsultancy
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...

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.