Click here to Skip to main content
15,917,321 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerSenthil's Reply for data bindings problem Pin
Senthil S9-Aug-07 0:20
Senthil S9-Aug-07 0:20 
GeneralRe: data bindings problem Pin
Sonia Gupta8-Aug-07 23:46
Sonia Gupta8-Aug-07 23:46 
GeneralRe: data bindings problem Pin
Nilesh Hapse8-Aug-07 23:57
Nilesh Hapse8-Aug-07 23:57 
AnswerRe: data bindings problem Pin
Urs Enzler9-Aug-07 2:09
Urs Enzler9-Aug-07 2:09 
Questiongprs Pin
ahzarmokhli8-Aug-07 22:35
ahzarmokhli8-Aug-07 22:35 
AnswerRe: gprs Pin
Dave Kreskowiak9-Aug-07 3:30
mveDave Kreskowiak9-Aug-07 3:30 
QuestionProblems in Dataset Update Pin
HinJinShah8-Aug-07 22:20
HinJinShah8-Aug-07 22:20 
AnswerRe: Problems in Dataset Update Pin
Dave Kreskowiak9-Aug-07 3:30
mveDave Kreskowiak9-Aug-07 3:30 
You've told the DataAdapter how to retrieve the columns, well, all of them, from the table, but you never told it how to update the database with changes.

It's much better practice to change your SQL to retrieve the columns to want instead of using the * specifier. This prevent your from making a change to the table schema and breaking your code doing it. In most case, you're end up returning far more data than you actually need, thereby killing your SQL Server performance, and if the dataset is transferred over a network, transferring way too much information and bogging down the network.

How you've written your data layer in not a good idea. You're creating a generic method that returns a DataAdapter, but that DataAdapter doesn't have a clue about what columns it's supposed to
SELECT IdColumn, SomeColumn, SomeOtherColumn FROM TableName

When you create the DataAdpater, you need to tell it how to update the coumns in the tables. To do this, you either have to supply the DataAdapter with the SQL commands for UPDATE, INSERT, and DELETE, or you have to use an SqlCommandBuilder object to do it for you:
Dim conn As New SqlConnection(connectionString)
Dim comm As New SqlCommand("SELECT IdColumn, SomeColumn FROM SomeTable", conn)
Dim da As New SqlDataAdapter(comm)
Dim cb As New SqlCommandBuilder(da)

Dim ds As New DataSet()
da.Fill(ds)

Return ds

Warning: This could be a little off. I wrote it from memory, and I'm half asleep right now...


A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: Problems in Dataset Update Pin
HinJinShah10-Aug-07 0:05
HinJinShah10-Aug-07 0:05 
QuestionForm in a Form Pin
Trupti Mehta8-Aug-07 21:51
Trupti Mehta8-Aug-07 21:51 
AnswerRe: Form in a Form Pin
MartyK20078-Aug-07 22:03
MartyK20078-Aug-07 22:03 
QuestionRe: Form in a Form Pin
Trupti Mehta9-Aug-07 0:56
Trupti Mehta9-Aug-07 0:56 
AnswerRe: Form in a Form Pin
MartyK20079-Aug-07 1:36
MartyK20079-Aug-07 1:36 
AnswerRe: Form in a Form Pin
Tom Deketelaere9-Aug-07 1:41
professionalTom Deketelaere9-Aug-07 1:41 
AnswerRe: Form in a Form [modified] Pin
Tom Deketelaere8-Aug-07 22:39
professionalTom Deketelaere8-Aug-07 22:39 
AnswerRe: Form in a Form Pin
Luc Pattyn9-Aug-07 1:57
sitebuilderLuc Pattyn9-Aug-07 1:57 
AnswerRe: Form in a Form Pin
Dave Kreskowiak9-Aug-07 3:15
mveDave Kreskowiak9-Aug-07 3:15 
AnswerRe: Form in a Form Pin
Trupti Mehta9-Aug-07 4:09
Trupti Mehta9-Aug-07 4:09 
QuestionDrag and move a control in a form Pin
Mogtabam8-Aug-07 20:22
Mogtabam8-Aug-07 20:22 
AnswerRe: Drag and move a control in a form Pin
Nilesh Hapse8-Aug-07 20:33
Nilesh Hapse8-Aug-07 20:33 
AnswerRe: Drag and move a control in a form [modified] Pin
Tom Deketelaere8-Aug-07 20:39
professionalTom Deketelaere8-Aug-07 20:39 
AnswerRe: Drag and move a control in a form Pin
Dave Kreskowiak9-Aug-07 3:11
mveDave Kreskowiak9-Aug-07 3:11 
QuestionSetup For Vb.net Project Pin
K03068-Aug-07 18:51
K03068-Aug-07 18:51 
AnswerRe: Setup For Vb.net Project Pin
Christian Graus8-Aug-07 19:08
protectorChristian Graus8-Aug-07 19:08 
QuestionDave, can u pls help me with this..?? Pin
Xandip8-Aug-07 17:37
Xandip8-Aug-07 17:37 

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.