For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Once you have given a table an alias you can then no longer use the tablename to qualify which fields you want - you must use the alias. For example, this query
SELECT A.StaffName, tblCampuses.CampusName,
LessonPlanning, LessonPreprn, Regularity,
((LessonPlanning + LessonPreprn + Regularity) / 3) AS AvgScore
FROM tblStaffInfo A
INNERJOIN tblCampuses B ON A.CampusID = B.CampusID
INNERJOIN tblStaffEvaluation C ON C.StaffID = A.StaffID
will generate the error
Msg 4104, Level 16, State 1, Line 24
The multi-part identifier "tblCampuses.CampusName" could not be bound.
It should be B.CampusName.
For the first part of your question you will have to explain to us what "The above Sql shows hatred for the division (/) sign" means. There is no error generated by your query and if the fields are defined as INT on the table schema then it gives the correct results. You will get strange results if you have stored those scores as char or varchar fields.
I have one question regarding migrating excel to datagridview.I have an excel consists of 4 sheets can this be acheived in datagridview or any other tool in dotnet,if so please reply me how can we acheive this.
Yes it can be achieved, but you need to provide more details of what you are trying to do. You can display a single sheet in a DataGridView directly with binding. If you wish to display the content of all four sheets then you would need some code to read and rearrange all the data.
I have gridview with 4 columns(Request_id,Allocate_id,number_plate,name)
I have to populate data from sql server table in number_plate which is columntype DataGridViewComboBoxColumn.
i have written below code:
Private Sub pop_num_DGV()
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim cbn As DataGridViewComboBoxColumn = DirectCast(dgvtarget.Columns(2), DataGridViewComboBoxColumn)
conn = GetConnect()
cmd.Connection = conn
cmd.CommandText = "select distinct number_plate from tbVehicle where status='Available'"
Dim Adpt As New SqlDataAdapter(cmd.CommandText, conn)
Dim ds As New DataSet()
Have you used your debugger to check that the SQL query is returning some records? Have you tried using the exact same spelling for your member name as the database column, i.e "number_plate" rather than "Number_Plate"?
I had been trying to code a DatagridView with multiple tables, without much success, until I found the following code; which seems fulfilling my aspirations:
PrivateFunction GetDataSource() As DataTable
Const sqlSelect AsString = "SELECT a.Col1 AS aCol1, a.Col2 AS aCol2, b.Col1 AS bCol1, b.Col2 AS bCol2 " & _
"FROM dbo.TableA AS a
INNER JOIN dbo.TableB AS b ON a.IdCol = b.aIdCol " & _
"ORDER BY aCol1 ASC, bCol1 ASC"TryDim table = New DataTable()
Using con = New MySqlConnection(My.Settings.MySqlConnectionString)
Using da = NewMySqlDataAdapter(sqlSelect, con)
EndUsingEndUsingCatch ex As Exception
' log message instead '
Throw' don't use throw new Exception or throw ex '
EndTryEndFunctionme.DGV1.DataSource = GetDataSource()
But, unfortunately, it gives a couple of the following errors:
MySqlConnection is not defined
MySqlDataAdapter is not defined
Looking forward for some explanation and remedy for these errors.
The code and your title have nothing to do with each other.
Declaring a const within a method is just wrong, it should be a class level constant!
Having declared it you do not use it instead you use My.Settings.MySqlConnectionString which does not exist.
MySqlDataAdapter is also not declared in the method (it is probably declared somewhere else in the source you copied from).
You are running across the fundamental problem with cut and paste learning. You are trying to use some code you found with no understanding what it does. You will now get piecemeal explanations which you do not understand (above is an example).
Get a book, READ it and work through the examples, when you have a basic understanding come back and we can be of more use to you.
Never underestimate the power of human stupidity
Sorry for another show up with hope.
I am still stuck with the
Dim conxnString AsString = My.MySettings.sqlConnectionString
Dim conxnString AsString = My.Settings.sqlConnectionString
VisualStudio 2015 says "sqlConnectionString is not a member of MySettings"
Do I need to Import some Library, other than System.Data.SqlClient ?
My whole code is as below:
PrivateFunction cboCampuses_SelectedValueChanged(sender AsObject, e As EventArgs) Handles cboCampuses.SelectedValueChanged
Dim selectedValue AsString
selectedValue = cboCampuses.SelectedValue
Me.StaffEvaluationDGV.DataSource = GetDataSource(selectedValue)
EndFunctionPrivateFunction GetDataSource(selectedValue) As DataTable
Dim sqlSelect AsString = "SELECT * FROM tblEvaln " &
"WHERE CampusName = " & selectedValue
Dim SqlConnection As SqlConnection
Dim conxnString AsString = My.MySettings.sqlConnectionString
TryDim table = New DataTable()
Using con = New System.Data.SqlClient.SqlConnection(conxnString)
Using da = New System.Data.SqlClient.SqlDataAdapter(sqlSelect, con)
EndUsingEndUsingCatch ex As Exception
' Error message here
The string you're attempting to insert exceeds the defined length for the target column. Either make the column "larger", if you're at liberty to do so, or take care not trying to insert longer strings than in can hold. The same applies to binary (blob) columns.
Also, you should never use string-concatenation to build SQL-statements. It's bad for a lot of reasons, the risk of losing your database to SQL-injection being the most prominent one. Use SQL-parameters instead.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
Stop whatever you're doing. Learn about SQL Injection, and realise that it's so simple to exploit that even a 3 year old can do it[^]. Then go back through all of the code you've written so far and fix this massive security vulnerability.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I am planning to migrate from MSFlexGrid to MsHflexGrid. In MSFlexGrid, when the .col /.row property is changed programmatically, the rowcolchange event gets fired. But in MsHflexGrid the same doesn’t work. However, on manually changing the .col/.row property through mouse click or using navigation keys, the event gets fired in MSHFlexGrid
Hello, I am Quintus S. Creator of QuinSoft Netherlands and the software-collection programs named SniperOS for DOS.
I am now coding version 3 on Visual BASIC 6 for a platform upgrade and useability change. And by software-collection I mean that SniperOS is basically one program containing a lot of tools, games and other useful stuff in one package.
I am now searching everywhere to get software that people might like and/or use, so I am now asking the forum if they/you might have something others can enjoy. If you have any questions, mail me.
Thank you for your help or even just reading this.
It's like cars - most people would like a nice new car for reasons of comfort, performance and features, but some people like classic cars that can be temperamental and don't have many of the luxuries of modern design. There is nothing wrong with this, but if you are asked to provide a taxi service I would expect it to use modern cars with aircon and satnav, rather than a Morris Minor or Model T Ford.
I'm an optoholic - my glass is always half full of vodka.
I think people are not entirely sure what you are asking.
Do you need code samples and such, or do you just want ideas on what sort of programs you could try to code using VB6 ?
If you want samples, you need to be more specific as to what of, and you need to show that you have made some sort of effort already yourself. Show some code that you have written that you want help with.
If you want ideas for programs to code in VB6, then you are not asking in the right place. On this forum you can get help realizing your coding goals, but very very little in determining what these goals should be.
My advice is free, and you may get what you paid for.