Click here to Skip to main content
15,913,027 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Screengrabbing, best way? Pin
Super Lloyd23-Jan-10 12:11
Super Lloyd23-Jan-10 12:11 
GeneralRe: Screengrabbing, best way? Pin
Stevie24-Jan-10 1:25
Stevie24-Jan-10 1:25 
GeneralRe: Screengrabbing, best way? Pin
Super Lloyd24-Jan-10 3:35
Super Lloyd24-Jan-10 3:35 
GeneralRe: Screengrabbing, best way? Pin
Stevie24-Jan-10 3:50
Stevie24-Jan-10 3:50 
Questionhow to update dabase using oledb connection Pin
akosidandan23-Jan-10 3:02
akosidandan23-Jan-10 3:02 
GeneralRe: how to update dabase using oledb connection Pin
Som Shekhar23-Jan-10 3:06
Som Shekhar23-Jan-10 3:06 
GeneralRe: how to update dabase using oledb connection Pin
akosidandan23-Jan-10 3:21
akosidandan23-Jan-10 3:21 
GeneralRe: how to update dabase using oledb connection Pin
Som Shekhar23-Jan-10 3:34
Som Shekhar23-Jan-10 3:34 
ok. I understand that sometimes it becomes frustrating when you don't get a job done. But please maintain a single thread of question. Posting the same question many times is not gonna solve it. Someone who has already responded you will be in a better position to help you out.

In any case, what we are gonna do is to create a table and get it done.

create a new table in your access database and name it: "MyTable".

Create three columns:

1. ID = AutoNumber =>Set it as key (You need to right click on the column and select primary key)
2. FirstName = Text
3. LastName = Text

Now, write this code in your program:

Dim con As New OleDb.OleDbConnection
Dim inc As Integer
Dim MaxRows As Integer
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim dt As DataTable



Private Sub Sampler_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    ds = New DataSet("dataSet")
    dt = New DataTable()
    ds.Tables.Add(dt)
    con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
    "Data Source = c:\Sadsign.mdb"

    'This is where we load the table
    con.Open()
    sql = "SELECT * FROM MyTable"
    da = New OleDb.OleDbDataAdapter(sql, con)
    da.Fill(dt)
    con.Close()

    'This is where we add a new row in the table

    Dim row As DataRow = dt.NewRow()
    row.Item("FirstName") = "MyFirstName"
    row.Item("LastName") = "MyLastName"
    dt.Rows.Add(row)


    'This is where we update the table in database.
    con.Open()
    sql = "SELECT * FROM MyTable"
    da = New OleDb.OleDbDataAdapter(sql, con)
    Dim cb As New OleDb.OleDbCommandBuilder(da)
    da.Update(dt)
    con.Close()

    'We Are Done

End Sub


Now, this code is working on my computer so, it should work on yours too provided you did exactly as i said.
GeneralRe: how to update dabase using oledb connection Pin
akosidandan23-Jan-10 4:45
akosidandan23-Jan-10 4:45 
GeneralRe: how to update dabase using oledb connection Pin
Som Shekhar23-Jan-10 4:47
Som Shekhar23-Jan-10 4:47 
GeneralRe: how to update dabase using oledb connection Pin
akosidandan23-Jan-10 4:51
akosidandan23-Jan-10 4:51 
GeneralRe: how to update dabase using oledb connection Pin
Som Shekhar23-Jan-10 4:52
Som Shekhar23-Jan-10 4:52 
GeneralRe: how to update dabase using oledb connection Pin
akosidandan23-Jan-10 5:02
akosidandan23-Jan-10 5:02 
QuestionGridview Sort Problem Pin
tims8122-Jan-10 6:28
tims8122-Jan-10 6:28 
AnswerRe: Gridview Sort Problem Pin
Eddy Vluggen24-Jan-10 2:08
professionalEddy Vluggen24-Jan-10 2:08 
GeneralRe: Gridview Sort Problem Pin
tims8125-Jan-10 6:51
tims8125-Jan-10 6:51 
GeneralRe: Gridview Sort Problem Pin
Eddy Vluggen25-Jan-10 8:30
professionalEddy Vluggen25-Jan-10 8:30 
GeneralRe: Gridview Sort Problem Pin
tims8126-Jan-10 10:20
tims8126-Jan-10 10:20 
GeneralRe: Gridview Sort Problem Pin
Eddy Vluggen26-Jan-10 11:43
professionalEddy Vluggen26-Jan-10 11:43 
GeneralRe: Gridview Sort Problem Pin
tims8126-Jan-10 13:01
tims8126-Jan-10 13:01 
GeneralRe: Gridview Sort Problem Pin
Eddy Vluggen27-Jan-10 0:51
professionalEddy Vluggen27-Jan-10 0:51 
GeneralRe: Gridview Sort Problem Pin
tims8127-Jan-10 12:46
tims8127-Jan-10 12:46 
GeneralRe: Gridview Sort Problem Pin
Eddy Vluggen27-Jan-10 13:14
professionalEddy Vluggen27-Jan-10 13:14 
GeneralRe: Gridview Sort Problem Pin
tims8127-Jan-10 14:10
tims8127-Jan-10 14:10 
GeneralRe: Gridview Sort Problem Pin
Eddy Vluggen28-Jan-10 1:27
professionalEddy Vluggen28-Jan-10 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.