I have made a SQL table within Visual Basic 2012.
I then made my dataset for inserting data.
I made a form and linked it to the table adapter and when the program is running it allows the data to be added to the table but when I reopen the application that data is not there.
I have tried two acceptchanges but they don't work. So it is not saving it the data that is in the "temporary table".
Me.TableTableAdapter1.InsertQuery(TextBox1.Text, TextBox2.Text, Dropdownseats.Text, dropdriver.Text)
BusesDataSet1.Table.AcceptChanges()
BusesDataSet1.AcceptChanges()
Does anyone one know why this is happening?????
*Changed the database to MS Access and I am still having problems. *
Related
I am using SSMS 2012 express and I have got into some case, maybe you can help me.
I am running a simple script like:
select * from table.
The table gets new data every day by some service. But I can see the new data only if I would reconnect to the database or refresh the tables.
Otherwise I don't see the new data.
What could be the issue
Using VS 2013 (VB) and SQL Server 2012.
I execute a stored procedure to populate a gridview using linq.
Dim db As New GMConnectionDataContext
Dim gasHedges = db.GasHedges_create2ndMonth.ToList
The stored procedure returns a result set and has been working fine as in it returns the expected result and the gridview displays as desired.
I added some data to my SQL table and loaded the web page and the new data does not show. IF I execute the stored procedure in SQL Server the new data shows. If I execute the stored procedure in VS the new data shows.
Now the weird bit. If I delete the reference to the stored procedure from the .dbml file then re-add it the new data shows when the page is loaded. I know that when using this file if I add columns to a table then I need to delete it and re-add the table to the .dbml file.
Surely the same isn't the case with stored procedures as they would be unusable. Is there something I am missing?
UPDATED
I think I know why this happening but I don't know how to fix it. The SQL result set has dynamic columns as I use the pivot command in SQL. This means that if a user creates a new Gas company the result set will have another column and the datacontext must interpret that as the SP having changed and still shows the old dataset. This does mean I cannot just delete the SP from the datacontext and re-add it as the web application needs to handle if the user adds another company.
Any changes you make in SQL server are not auto-synched to your .dbml file. If you make table or stored procedure changes you need to delete them from the .dbml file and add them again.
Best practices would dictate that you don't pivot your data in SQL. Pivotting data is not a data related issue; it's presentation and should be done in the presentation layer -- in the application.
So far, I have created 3 tables in SQL using visual studio. They have been connected to my VB project file and I can view the data held within them using the Database Explorer.
My only problem is: how do I use/make available the data held within each table?
I need to write code which will add a Japanese character (from one of the tables that already exists) to a new table when a check box is ticked. Then I need to write code to update the table and save the changes.
I have absolutely no idea how to retrieve the data held in each table nor how to write a SQL query in VB.
Any help would be appreciated.
I'm building a new Access 2007 database with a large number of tables. Designed a form with multiple tabs to display the fields from various tables, which all have a relationship with each other. When new data is entered it is all being saved correctly to the various tables. However, when the form is opened it is not displaying any of the data stored in the tables. The form properties seem to be set correctly, it allows additions and editing and is not set for data entry only. Running the query that is the recordsource fails to return any records, which looks like the problem lies there, and yet the recordsource must be correct if it is able to save the new data entered to the right tables. Any ideas on what the problem might be?
Check you database connection If database connection is established correctly then you need to check you database query e.g if you are writing this query
Select * from tableName
Just copy it and run in access sql query editor if that work fine it means some thing is wrong in you form data retrrvil mechanism.
Hope it helps you
I am coding ib Visual Basic. I need to store the current system time in MS Access timestamp field. How do I go about it.
Dim row As DataRow = ds.Tables("StudentTable").NewRow
row("SSMA_TimeStamp") = System.DateTime.Now.ToString()
The field name starting with SSMA makes me think that his is a SQL Server table and that its been upsized from Access using the SQL Server Migration Assistant for Access If so Access isn't involved here at all.
If this is indeed the case then it's almost certainly a SQL Server TimeStamp aka RowVersion column which is not updatable by users or code. It is a special field that changes only when data in the row changes. This makes a lot less work for Access (and other programs if they use it) to see if the row has been changed elsewhere when Access goes to update the data. Read up on it in Books Online.