|
Hi
I have created a new dataset based on a schema based on my database. I have added a new row a table in the dataset and am now trying to Insert this into the database. When I run it I do not get any errors, or do any records go into the database. What am I doing wrong?
<br />
newDataSet.Tables("tblHouse").Rows.Add(newAddress)<br />
newDataSet.AcceptChanges()<br />
Dim myTable As New DataTable = newDataSet.Tables("tblHouse")<br />
<br />
myAdapter2.Update(myTable)<br />
The FOZ
|
|
|
|
|
hi
try to replace this
Dim myTable As New DataTable = newDataSet.Tables("tblHouse")
by this
myAdapter2.Update(newDataSet,"tblHouse")
Tamimi - Code
|
|
|
|
|
That didn't work. Thanks anyway. Got anymore suggestions?
Cheers
The FOZ
|
|
|
|
|
Don't execute AcceptChanges() until AFTER the .Update() is executed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave. That has worked for when I am changing a record. What if I have added a new record.
The interface I have at the moment is a simple data bound form bound to a DataTable. The user presses the next button to add a new record. This is the code I used in the button
<br />
Me.BindingContext(myTable).AddNew()<br />
myTable.NewRow()<br />
When I try and save the new record to the database I get an
"System.Data.OleDb.OleDbException" error come up.
Many Thanks for the previous reply.
The FOZ
|
|
|
|
|
Don't call AddNew on the BindingContext object. You're not adding a Binding to anything, soooo...
Call NewRow on the table you want to add a row to. A new DataRow object will be created, according to the schema of the table, and returned. It does not add this row to the table!
Dim nr As DataRow
nr = myTable.NewRow()
You can then set the fields in the new DataRow to whatever you want, then just add it to the table:
myTable.Rows.Add(nr)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Cheers. Many thanks for that. The book I've got isn't all that good. Couldn't really find an example on the MSDN Either.
Thanks again
The FOZ
|
|
|
|
|
How to access a mdichild in other application which starts in runtime in our own application
bzasri
|
|
|
|
|
bzasri wrote: How to access a mdichild in other application which starts in runtime in our own application
What does it mean?
|
|
|
|
|
Uhhh... What? You're post appears to say that you're creating an MDIChild window in another application. This is just not possible.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
bzasri wrote: How to access a mdichild in other application which starts in runtime in our own application
|
|
|
|
|
Sir and Madam,
Please advice me about "Screen Text Hooking Project".
Thank You very much.
|
|
|
|
|
|
dear friend...
if i have a form in vb.net such as (A) and another application in c language such as (B) how can i control the application (B) from the buttons based on form (A) and i mean of control :
1-run application B
2-minimize and mazimize form B
3-close form B
4- the most thing is make the form A always active that mean you cant use the appliation B except throught the form (A)
thanx all
kilany
|
|
|
|
|
|
still not find it /... may i get more detail
kilany
|
|
|
|
|
While it's entirely possible, your application sounds more complicated than it should be. For curiosity, why do you want to do it this way?
Best,
Jun
|
|
|
|
|
OK I WILL TELL U WHY?
i have old appllication build on C and i creat a interface with a vb.net form which let user to write somthing in the old system.the problem that i need to force the user to use the vb.net form to write in old application without click on old application and write on it .. that mean i need a way to make a old system behaive as a child of vb.net form ...do you know when we make as this example :
dim a as form1
a.showdialog()// that mean you cant edit a perant without close the child ..
that what i need .. i need to make the old system as a child which prevent the user modify except through the vb.lnet form
thanx alot for you ..
kilany
|
|
|
|
|
It looks like a multi-process application. The communication between your old and new has to go through certain IPC. There are several IPC mechanisms which you choose from, socket, shared memory, RPC, COM, etc.
Best,
Jun
|
|
|
|
|
hi i want to generate table from sql script but dont know how to execute the sql script so i m using selected code from script file to generate table.
String strQuery="CREATE TABLE tblServer (ServerName nvarchar(50) NOT NULL,UserId nvarchar(50) NOT NULL,Password nvarchar(50) NOT NULL)";
SqlConnection conn= new SqlConnection(strConn);
conn.Open();
SqlCommand cmd=new SqlCommand(strQuery,conn);
cmd.ExecuteNonQuery();
conn.Close();
but it gives sql exception i dont know why.what i want to do is create table when app starts on sql server. if you tell me technique of executing sql srcipt file or other method
Tasleem Arif
|
|
|
|
|
|
Hi,
I have read that an array list stores objects. So, if an application creates Picturebox control objects at run time, can they be stored in an array list at run time?
Is an array list an array of objects or a linked list of objects?
Also, how do I pass the array list to a public sub as an argument?
LiLo is online now Add to LiLo's Reputation Edit/Delete Message
|
|
|
|
|
hi
yes , you can consider "an array list an array of objects or a linked list of objects", also you can create an array of Picturebox !!
pass the array list like this :
Dim zzz As New ArrayList
zzz.Add("a")
zzz.Add("b")
zzz.Add("c")
Dim c As Integer = zzz.Count
SunName(zzz)
Dim dd As Integer = zzz.Count
.
.
Sub SunName(ByVal al As ArrayList)
al.Add("5")
End Sub
' notes that all the operations on arrays on general are done
' by referance , notes the count of the items before and after the call
' of the sub
hope its help
Tamimi - Code
|
|
|
|
|
Yup got it......thank you for the help!
|
|
|
|
|
I 1 2 crate form when it running it look like person, car, something else, can anyone help me?
Thanks
................
|
|
|
|