I've posted serveral times to get an answer, but till now still now
satisfying answers.
Here is my problem:
I have filled a datagrid control with the contents of an Excel sheet.
Over 3500 rows of information.
I used a dataset which I then binded to the control.
That worked.
Now I want to read the (changed) info from the datagrid into a SQL-server
database.
I have had a hard time finding an example that shows me clearly how to do
that.
Most people answered with documents to me, but that didn't make it more
clear.
I think I have to update the dataset with the changed information first, but
how???
Then I think I have to 'write' this dataset to a SQL file, but how???
I hope someone can give me a good and solid example that can teach me on
this stuff...
Thanks,
Eric 4 1174
Hi EMW,
Does this helps you a little bit.
\\\
Public Shared Sub UpdateDataset(ByVal sqlStr As String, ByVal ds As DataSet)
Dim Conn As New SqlConnection(connString)
Try
Dim da As New SqlDataAdapter
da.SelectCommand = New SqlCommand(sqlStr, Conn)
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(da)
If ds.HasChanges Then
da.Update(ds.GetChanges)
End If
Catch sqlExc As SqlException
MessageBox.Show(sqlExc.ToString, "", MessageBoxButtons.OK,
MessageBoxIcon.Error)
Catch ex As Exception
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
MessageBoxIcon.Error)
Finally
Conn.Close()
End Try
End Sub
///
Cor
Hi Cor,
It helps a little, but I'm still confused of what to put in the
connectionstring, since I want everything to be put in the file, I set the
SQLstr on "SELECT *". but for the rest I'm still in the dark...
Can you please help me some more?
thanks.
Eric
"Cor" <no*@non.com> schreef in bericht
news:uj**************@TK2MSFTNGP09.phx.gbl... Hi EMW,
Does this helps you a little bit. \\\ Public Shared Sub UpdateDataset(ByVal sqlStr As String, ByVal ds As
DataSet) Dim Conn As New SqlConnection(connString) Try Dim da As New SqlDataAdapter da.SelectCommand = New SqlCommand(sqlStr, Conn) Dim cb As SqlCommandBuilder = New SqlCommandBuilder(da) If ds.HasChanges Then da.Update(ds.GetChanges) End If Catch sqlExc As SqlException MessageBox.Show(sqlExc.ToString, "", MessageBoxButtons.OK, MessageBoxIcon.Error) Catch ex As Exception MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try End Sub /// Cor
Hi Eric,
That is the easiest,
"SELECT * FROM tablenaam"
tablenaam is the name of your SQL table.
That is all.
Cor
You have to create insert statement. http://www.naptaxes.com/AAJ/
[AllAmericanJobs - Searching jobs from your desktop and automatically
sends resume.]
"EMW" <so*****@microsoft.com> wrote in message news:<3f**********************@dreader2.news.tisca li.nl>... Hi Cor,
It helps a little, but I'm still confused of what to put in the connectionstring, since I want everything to be put in the file, I set the SQLstr on "SELECT *". but for the rest I'm still in the dark...
Can you please help me some more?
thanks. Eric "Cor" <no*@non.com> schreef in bericht news:uj**************@TK2MSFTNGP09.phx.gbl... Hi EMW,
Does this helps you a little bit. \\\ Public Shared Sub UpdateDataset(ByVal sqlStr As String, ByVal ds As DataSet) Dim Conn As New SqlConnection(connString) Try Dim da As New SqlDataAdapter da.SelectCommand = New SqlCommand(sqlStr, Conn) Dim cb As SqlCommandBuilder = New SqlCommandBuilder(da) If ds.HasChanges Then da.Update(ds.GetChanges) End If Catch sqlExc As SqlException MessageBox.Show(sqlExc.ToString, "", MessageBoxButtons.OK, MessageBoxIcon.Error) Catch ex As Exception MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try End Sub /// Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Newbee |
last post by:
Hi !
Let's say that this is the folder on the server:
/web/firstDir/secondDir/images/image.gif
where i have stored my pictures. I have tryed with apsolute and relative
paths but i can't display...
|
by: Newbee Adam |
last post by:
some said that .NET app can run on any program where rutime exists. What is
"runtime" in this sense?
will I have to install runtime or .net framework or .NET support on an xp
machine for a...
|
by: PerryC |
last post by:
All,
1. Do the following codes seem ok?
2. If so, then how do I pull the value of YOE1 and YOE2 into my
report? (to do some further calculations)
...
|
by: Martin Hvidberg |
last post by:
Dear list
I have found a declaration like this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "ectemp.h"
|
by: EMW |
last post by:
I have created a page in aspx and after a click on a button, a new page
should open.
How is this possible?
I tried it doing it like in vb.NET with opening a new form, but it doesn't
work.
rg,...
|
by: EMW |
last post by:
I've posted serveral times to get an answer, but till now still now
satisfying answers.
Here is my problem:
I have filled a datagrid control with the contents of an Excel sheet.
Over 3500...
|
by: Greg P |
last post by:
I'm new to VS2005 and want to simply update my data with the dataGridView
that was generated when I draged my query from the Data Sources Pane. I
think I may need to create a Data Adaptor but I'm...
|
by: ikarias |
last post by:
Maybe not the right place to aske this, but a newbee (me) needs help.
i trying to input a number into a textbox, so i can make a series of calculations. in the old days of basic i just jused...
|
by: Mel |
last post by:
I have a selection box with 3 values. what i need is to pass 3 urls to
a function that has a switch statement and based on the selection
index goes on one of the tree urls.
Question is how do i...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |