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

Problem on INSERTING a record to database using typed datasets

Dear All,
I have problem on inserting a record to database..Although 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......>INSERT INTO TABLE1 (NAME,CITY) VALUES (?,?)

Then in My .Vb file i called this method as
Adapter1.Insert("Value1",Value2").. before that
i used Adapter1.connection.open() and Adapter1.connection.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 3333
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.comwrote in message
news:11**********************@y42g2000hsy.googlegr oups.com...
Dear All,
I have problem on inserting a record to database..Although 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......>INSERT INTO TABLE1 (NAME,CITY) VALUES (?,?)

Then in My .Vb file i called this method as
Adapter1.Insert("Value1",Value2").. before that
i used Adapter1.connection.open() and Adapter1.connection.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.Update command, am I right or did you
not show it?

Cor

"Surya" <su*************@gmail.comschreef in bericht
news:11**********************@y42g2000hsy.googlegr oups.com...
Dear All,
I have problem on inserting a record to database..Although 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......>INSERT INTO TABLE1 (NAME,CITY) VALUES (?,?)

Then in My .Vb file i called this method as
Adapter1.Insert("Value1",Value2").. before that
i used Adapter1.connection.open() and Adapter1.connection.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
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...
6
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...
4
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...
7
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...
2
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...
1
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...
1
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...
12
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...
12
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 = _...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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...
0
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,...

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.