|
-
Jun 2nd, 2006, 04:24 PM
#1
Thread Starter
Addicted Member
C# and Database: How to Insert New record and save it
Dear All,
I am a very much new to C#. Today I developed my first database application using c#.
I am doing this to bind records:
txtLastName.DataBindings.Add("text", myds, "pm.last_name");
To move to next record(clicking next button):
CurrencyManager cm = (CurrencyManager)this.BindingContext[myds, "pm"];
if (cm.Position < cm.Count - 1)
{
cm.Position++;
}
else
MessageBox.Show("End of records", "my application", MessageBoxButtons.OK, MessageBoxIcon.Information);
and so on.
I have completed the record navigation functionality(FirstRecord, LastRecord, Next, Previous).
Problem:
I don't know how can I insert a new record and save it.
Please guide me in the above mentioned application.
Also recommend a good tuturial+example on web.
Thanks
Last edited by engineer; Jun 2nd, 2006 at 05:20 PM.
software engineer
-
Jun 3rd, 2006, 03:38 AM
#2
Re: C# and Database: How to Insert New record and save it
There are numerous tutorial links in my signature. Some are ADO.NET specific and others have ADO.NET sections but much more besides.
-
Jun 6th, 2006, 05:35 PM
#3
Thread Starter
Addicted Member
Re: C# and Database: How to Insert New record and save it
Ok. I am going to look into the links.
Thanks.
-
Jun 6th, 2006, 06:17 PM
#4
Re: C# and Database: How to Insert New record and save it
Note that many of the tutorials are VB-based but the principles are exactly the same and there are links to code converters in my sig also, so you can convert the code examples if required. They are not 100% reliable but they do a good job in most cases and certainly enough to give you enough of an idea that you can fix any remaining issues by hand.
-
Jun 7th, 2006, 02:13 PM
#5
Hyperactive Member
Re: C# and Database: How to Insert New record and save it
What kind of database you're using? You could use a simple INSERT statement to insert into the table that you desire.
-
Jun 13th, 2006, 08:16 AM
#6
Frenzied Member
Re: C# and Database: How to Insert New record and save it
engineer:
As JenniferBabe pointed out, we don't know what DMS you are using.
Assuming you are using Access, you might find this example helpful.
Last edited by AIS4U; Jun 22nd, 2006 at 11:12 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|