I have tried very hard to get my database updated when I use the update/insert commands. I am running VB 2005 express edition beta 2.
I read somewhere that VB does not allow modifying a database as opposed to Visual Studio where you can update a database. is this true and how can i fix the problem.
more explicitly: Visual Studio.Net allows modifying whereas Visual Basic.Net standard edition supports only connecting and viewing a database.
Thanks

updating a database
salmanhasan
Sure you can add me - but if you enter questions into the forums then everyone can benefit and you may get a quicker response. The VB Forum is a good place to enter questions.
Scott Gurvey
Try
Dim MyConnection As New SqlClient.SqlConnection("server=xyz\sqlexpress;Database=DZManifest;Trusted_Connection=true") Dim mycommand As New SqlClient.SqlCommand("Insert Into BusinessCode (CodeType, Value, Description, Status) VALUES (0,2,'fred1',1)", MyConnection)MyConnection.Open()
Catch ex As Exceptionmycommand.ExecuteNonQuery()
MyConnection.Close()
MessageBox.Show(ex.Message)
End Try
Try to identify if there is an exception being raised that is letting you know why it can't update the database - which is they try ... Catch... End Try block with a messagebox displaying the exception message if there is a problem.
Optikal
I actually got it to work last night, but thanks anyways. I also put the connection string into the app settings and just used
My.Settings.SQLExpressConStr
to reduce typing and errors since there's a wizard to connect to the db.
It seems you're very knowledgable about DB, would you mind if I added you to my AIM list so that I may ask a question or two when I need it
atoenne
Barrett
Lee Barker
VB Express beta 2 allows updating database without a problem with a couple of caveats.
Microsoft Access or SQL Express are the two supported databases out of the box for express editions. I'm not sure which database you are trying to update.
All versions of visual basic support database access - the standard edition and above will support more database formats out of the box such as ODBC and oracle providers.
There are numerous samples of using the data binding capability to update databases using VB Express Beta 2. Do you have specific errors that are occuring when you are trying to update a database, what type of database are you trying to update.
iupetre
Spotty, I'm having similar problems; I'm running VB.net express beta 2 with ms sql express CTP. I'm trying to insert data into a database by using code only. Why Because I'm going to be adding hundreds of thousands of records. I've been reading some books on ado.net but it seems ado.net 1.1 doesn't work in 2.0 as with the express editions. Reading from 1.1 books, it seems I can connect to a db using the System.Data.SqlConnection class to connect to a ms sql db and then I can hardcode in sql queries using the System.Data.SqlCommand class or connect the SqlCommand class to a DataSet using a tableAdapter (dataAdapter in 1.1). But when I try to copy the EXACT code from my book it doesn't work in 2.0. I thought 1.1 ado.net code was suppose to work in 2.0 Help plz!
Nick
Srinivas Govada
This will bring up a daigram of the dataset.
If you select the dataset and use Configure... it allows you to configure the
Select, Insert, Update and Delete statements.
Depending on which ones you select (Example you may want to make the dataset ReadOnly and therefore wouldn't specific the insert/delete or update items).
This will create underlying sql commands which you can see by Right Clicking the TablesAdapter section at the bottom of the dataset and viewing the properties.
This will show such properties as SelectCommand, UpdateCommand, DeleteCommand and InsertCommand depending on how you configured the above.
You can then look at the specific SQL that each of these will run.
sofsab
I got that code up there to work BUT it doesn't save into the actually database once I close the program What am I doing wrong
Hans Karlsen (The real one)
http://blogs.msdn.com/smartclientdata/archive/category/10356.aspx
Best regards,
Johan Stenberg
Jack Michaelson
Wow thanks, I literally spent hours in my ado.net 1.1 book trying to figure it out!
Stark77
How could I check on this and how could I fix it
g.brausi