|
Did you consider panicking?
..or Googling for a tutorial on CR with VB.NET?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
A "table" is "rows and columns".
CR does rows and columns.
I think you're being too literal.
You can even use a "picture" of a table. Or "hard-code" it.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
im a begginer, anyone with idea on how to code in console using pattern printing
|
|
|
|
|
Yes, many people. But you need to provide much more detail about what pattern you are trying to print, and what problem you are getting in the code you have tried.
|
|
|
|
|
Hello !
I'm using entity framework 6 with Vb.net 2017 and sql server database.
I have this situation :
I have a bindingsource bound to an entity.
Mybindingsource.Datasource=( From t in context.mytable1 where t.nr>5 select t).Tolist
Some other user has updated the database , and one of the item on this bindingsource should be refreshed because is updated. ( On bindingsource I know the item that is updated on database ).
I want to know how to refresh that item , without executing again the query above that fill the entire bindingsource ?
Thank you !
|
|
|
|
|
You execute the query again. You have no choice.
|
|
|
|
|
If you are not going to use "equals", then you use FirstOrDefault(); else SingleOrDefault(); not "ToList".
("xxxOrDefault" because you will "crash" if your entity set is empty);
Then check the SQL generated to confirm your intentions (db call logging option).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi, I'm new here and just recently found this great messageboard. I'm working on a peice of code that requires a program to link to a database with multiple tables in it. I'm trying to link the program to the database and then use a combo box (or some other GUI object) "point" to the different tables in the database but I can't seem to figure it out. Here is the following code I'm using...
Private Sub cmbloadMasterSchedule_click()
dlgcommonDialog.Filter = "Microsoft Access Database Applications(*mdb)"
dlgCommonDialog.ShowOpen
AdoTeamStatsInputUtility.ConnectionString = dlgCommonDialog.InitDir
End Sub
Private Sub ClickEvent()
AdoTeamStatsInputUtility.RecordSource = AdoTeamStatsInputUtility.ConnectionString
cmbListTablesInRecordSet.ItemData (adoTeamStatsInputUtility.RecordSource)
End Sub
I just can't seem to make the combo box display the tables of the Database or allow it to point to a particular Table within the Database. Does anyone have any advice on this?
|
|
|
|
|
Where is the code that builds the combo box?
|
|
|
|
|
Private Sub ClickEvent()
AdoTeamStatsInputUtility.RecordSource = AdoTeamStatsInputUtility.ConnectionString
cmbListTablesInRecordSet.ItemData (adoTeamStatsInputUtility.RecordSource)
End Sub
That is the code that builds the combo box. I know, its not much. That is where the problem is. I'm actually just guessing on how to do it. What I was hoping for is too have the database link with the connection string from the above code, I could use the combo box (with listed tables within the Combo Box) to "Point" to the particular Table I want to input the data.
|
|
|
|
|
|
I'll bet a banana that there is in VB6.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Yes, I'm using Visual Basic 6. Ill look up the "ItemData" object in the MSDN Library. I have some revised code that might be a little clear on this topic. I found out I was using the wrong database object to access the Database. How about this code...
Private Sub cmdLoadMasterSchedule_Click()
dlgCommonDialog.Filter = "Microsoft Access Database Applications(*.mdb)"
dlgCommonDialog.ShowOpen
Data1.Connect = dlgCommonDialog.InitDir
End Sub
Private Sub cmbListTablesInRecordSet_Click()
cmbListTablesInRecordSet.DataSource (Data1.RecordSource)
cmbListTablesInRecordSet.DataField ""
End Sub
I think this new code links to the database, but I'm still stumped on the second code part. I can access the data by clicking on the RecordSource property and choose a particular table to point too, but I still am not sure how to do it with the above code. .DataFeild and .DataSource properties still perplex me.
Any advice here with this new code?
|
|
|
|
|
D. Doulas wrote:
Any advice here with this new code? No, I don't support even the idea of writing anything new in VB6. It is a dead language and there's no good reason to use it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
With all due respect... but do you mind? This is probably the only message board left I can find tech support for VB.
|
|
|
|
|
D. Doulas wrote: This is probably the only message board left I can find tech support for VB. I don't mind you getting help from others; I do mind the idea of actively writing VB6-code.
..and it's not tech support; its a bunch of volunteers that you are depending on to keep it alive.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Also, a connection-string is not just a filepath.
Login Tutorial Using Access Database - Visual Basic .NET[^]; shows how to connect and read from the datbase.
D. Doulas wrote: Does anyone have any advice on this? Start with any tutorial that shows how to execute a query. Find a query that returns all table-names. Combine both ideas.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Great idea. I look again, but that is what I couldn't find in all my text books. I think the data is being read in the combo box but it just displays a blank combo box with no data.
|
|
|
|
|
D. Doulas wrote: I look again, but that is what I couldn't find in all my text books. "That" is probably referring to the query. Found here[^].
D. Doulas wrote: I think the data is being read in the combo box but it just displays a blank combo box with no data. Why do you think that? Have you tried alternative ways of displaying the data?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
txtPart.Text = mod_ValidateDBFldType(rstOrderID!PART_NUM, rstOrderID.Fields("PART_NUM").Value)
error 1:- field is not a member of the dataset
error 2:- class 'DataSet' cannot be indexed because it has no default property.
after these errors, I changed the code but nothing works.
after changing, I got a null exception error
(1)
txtPart.Text = CType((rstOrderID.Tables("tblOrder").Rows(0)("PART_NUM")), String)
txtOrderQty.Text = CType((rstOrderID.Tables("tblOrder").Rows(0)("ORDER_QTY")), String)
(2)
txtPart.Text = (rstOrderID.Tables("tblOrder").Columns("PART_NUM").ToString)
txtOrderQty.Text = (rstOrderID.Tables("tblOrder").Columns("ORDER_QTY").ToString)
|
|
|
|
|
A DataSet object is totally different to ADODB.Recordset!
To be able to read data from DataSet, you have to refer to DataTable object corresponding to data you fetched from.
Dim dt As DataTable = YourDataSet.DataTables("YourTableName")
For Each r As DataRow in dt.Rows
Next
Dim singleRecord = YourDataSet.DataTables("YourTableName").Rows(0)
txtPart.Text = singleRecord("PART_NUM").Value
Another way to get data from DataSet is to use Linq. See: Queries in LINQ to DataSet | Microsoft Docs
|
|
|
|
|
Thanks for your reply!
I tried what you said but it did not work
|
|
|
|
|
You're not going to be able to do a line-for-line conversion of the code. You're going to have to completely rewrite it in VB.NET, with the understanding of what the goal of the original VB6 code was.
|
|
|
|
|
Just changing it will not work. There are enough tutorials out there that show how to interact with a database. Good luck.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello !
How can I display an image at the center of a form , and this should remain at center even when I resize the form ?
Thank you !
|
|
|
|