PC Review


Reply
Thread Tools Rate Thread

beginner#vb.net using ado.net

 
 
MUHAMAMD SALIM SHAHZAD
Guest
Posts: n/a
 
      31st Aug 2003
dear respected sir,
i'm beginner in vb.net and ado.net enviornment...

i would like to work and learn business(database applicatiosn area),
please can any one help me solve this...

i wanted to make very simple windows forms,then by programming want to
create query, connection, datasets, dataadapter,databinding for using
oledb

but i am facing a lots problem in syntax i am stuck/dead

imports system.data
imports system.data.oledb

private sub form1_load(......some val,ref..etc)

dim cn as new oledb.oledbconnection("provider=microsoft.jet.oledb.4.0;date
source=c:\northwind.mdb")
cn.open
dim da as new dataadapter("select * from customers",cn)
dim ds as new datasets()
da.fill(ds,"cutomers")

textbox1.text = textbox1.databinding.add(ds,"companyname")

end sub

and i have some buttons add, edit, delete, update...

so i can not success above...can any one help me to tell in very
simple form and how to update actual datbase...in fact by using
dataset it is update modify data...using datagrids...but failure in
case of indvidual records on the forms...and plus only update at
datasets time...not actual when i close form and open again..then it
give me same no of old records...

please can any one give some guidence appreciated sir

urs obediently

shahzad
 
Reply With Quote
 
 
 
 
MUHAMAMD SALIM SHAHZAD
Guest
Posts: n/a
 
      1st Sep 2003
dear sir,

thanks a lots as u r like angel and teacher for me...

sir my problem, i want to do everything by programming...as by wizard
i sucees...but i could nt succes in add, edit delte records...any
single example will be enought to make me understand this all...

as it seems difficult, which is not ..as i am beginner in database
vb.net programming

so sir what i wanted to knew there is already i hve first, next, prev,
last buttons...and even update and load data is ther..but working on
dataset...but actual data did nt effect...

let us consuder i did all by wizard using da, ds, cn....but even
though dataset updates records but actual data did not

sir any samples examples of coding of access database will be
appreciated

thanks u very much

urs obedintly, shahzad
 
Reply With Quote
 
William Ryan
Guest
Posts: n/a
 
      1st Sep 2003
Muhamamd:

Imports System.Data
Imports System.Data.OleDb

Public Class SomeForm

Private cn as OledbCOnnection
Private da as OledbDataAdapter
Private cmdb as OleDbCommandBuilder
Private ds as DataSet

Then down in Form Load


cn = New OledbConnection("someConnectionString")
da = New OleDbDataAdapter("SELECT Blah from SomeTable", cn)

ds = New DataSet("SomeTableName")

da.Fill(ds)

cmdb = new OledbCommandBUilder(da)

Debug.WriteLine(cmdb.GetUpdateCommand.CommandText & " " &
cmdb.GetSelectCommand.CommandTexgt & " Whatever else you want to verify has
been generated")

Then assuming you had a DataGrid (dg)

dg.DataSource = ds.Tables(0)



On an update button or Grid Event that you want to signal update time

da.Update(ds)
ds.AcceptChanges()


If you had a Cancel button


ds.RejectChanges()

I think the Wizard is generating the code for you for update and insert
etc... but if you don't use it, you'll need to use a CommandBuilder
something like I have above, or write your own logic (which is sometimes
worth it, but CommandBuilders will often get you where you need to go)

If you need anything else, or have any questions, let me know.

Good Luck my friend,

Bill
"MUHAMAMD SALIM SHAHZAD" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> dear sir,
>
> thanks a lots as u r like angel and teacher for me...
>
> sir my problem, i want to do everything by programming...as by wizard
> i sucees...but i could nt succes in add, edit delte records...any
> single example will be enought to make me understand this all...
>
> as it seems difficult, which is not ..as i am beginner in database
> vb.net programming
>
> so sir what i wanted to knew there is already i hve first, next, prev,
> last buttons...and even update and load data is ther..but working on
> dataset...but actual data did nt effect...
>
> let us consuder i did all by wizard using da, ds, cn....but even
> though dataset updates records but actual data did not
>
> sir any samples examples of coding of access database will be
> appreciated
>
> thanks u very much
>
> urs obedintly, shahzad



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pls Help Beginner OG515@webtv.net Printers 1 5th May 2005 10:44 PM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= Microsoft ASP .NET 7 3rd Feb 2005 02:47 PM
Help for a beginner!.....PLEASE??? Tricia Microsoft Excel Misc 1 15th Jan 2004 06:51 PM
I'm a beginner milli reyes Microsoft Access Getting Started 2 15th Aug 2003 04:48 PM
Beginner Help.... Mike Bell Microsoft ASP .NET 1 12th Jul 2003 07:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:06 AM.