Run My MySQL Query?
May 2, 2011I'm trying to run a MySQL Query, but I keep getting a syntax error for this.[code]...
View 3 RepliesI'm trying to run a MySQL Query, but I keep getting a syntax error for this.[code]...
View 3 RepliesI have a query from within my vb.net code which searchs for a record by date. The date being entered via the code is in format dd/mm/yyyy, i need to search in the database using yyyy/mm/dd? Ideally i thought there may just be a function within MySQL which will convert this. If not in vb.net to convert the string 01/01/2011 to 2011/01/01?
View 1 RepliesIf I run a MySQL query at the same time I have a timer going, the timer lags, even though the query is on a seperate form. My computer has 8GB of RAM, so I doubt that that's the issue. Does VB stop the timer to run the query intentionally? Is there a way to prevent the timer from stopping/ lagging?
View 10 RepliesWith vb.net 2008 exp + MySQL 5.0
i am unable to get the data from a query / SP created in the database.
kindly have some patience to teach me what basically makes difference in extracting data from a table directly and from a QUERY / SP[code]....
My problem is, when I query by a usual ID, like number with no segments = 1234567890, it works nicely.
But I need to query by some kind of segmented values or ID as = 123-4567-890, when I try by 123-4567-890 this id it does not query anything in mysql although in the database this 123-4567-890 ID is present.
So what is the possible solution to search by segmented value in mysql in VB.NET Here is below, my trying codes in vb
[Code]...
So I'm working with a mysql database, and I already have some queries down. I have to make a windows application form in vb.net that can display the results of these queries in a dataGridView.Lets say I'm working with frm1, and i have datagrid1 which will be filled using the query "select * from xyz" when btn1 is clicked.Can someone please take me through the right steps to do that? References needed, connections to be made, etc. I did look through online materials, but they are mostly way too long and not dataGridView specific
View 2 RepliesI am trying to to an insert query on my MySql db using VS 2008/VB. I have this query: Insert into allservices StartDate....) values ('" & Me.datesched.Value & "', ....) When I use the single and double quotes, as it is above , I get this error: Quote: Incorrect date value '21/10/2009' for column StartDate at row 1
when I remove the single quotes and have only the double ones I get a completely different thing. The date inserted to the database is 01/01/0001. Even if my datetimepicker has a min and max date. Also if someone has any good links on using mysql with vb.net
i am using MySql with vb.net to insert some data in a MySql table and i am facing a problem with encoding.When i try to insert Greek characters the characters in the database are saved as. I made a research in net and found that a mysql query SET NAMES 'utf8'. Solves the problem. I made an execute command but doesnt work.
[Code]...
I am using VB to query a MySQl database and populate an Excel spreadsheet. All is working well, but now I would like to start distributing the spreadsheet shroughout the company and cannot protect it.If I protect the spreadsheet the VB cannot add the MySQL data, so I added an unprotect line at the start of the code. That works well, but now the sheet is
'Unprotect all sheets
Dim WSheet As Worksheet
For Each WSheet In Worksheets
[code]....
I'm trying to write my very first "serious" program using a mysql database. I use the mysql connecter dll to connect with my database. I have a subject and a visit table. I can select a subject and I can get all the visits for all subjects in a list box with:
[Code]...
I am new in VB.NET. Can any tell me how a richtextbox query MySQL table. i.e select * from table test where name= 'Bowser' then the richtextbox will display the results.
View 3 RepliesI'm just wondering if it's possibe to get the results from a query and then assign the results to a variable. So I will run a query which will return the names of the tables stored in the database, then I want them to be stored in a variable. So it would be something along the lines of:
Dim strFrom AS String = "FROM "
strQuery = "SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'Database1'"
con.Open()
[Code]....
I am finding it exceptionally difficult to pass an sql query result (string) into a variable.No matter what I try, I can't seem to get anything but boolean output from my reader function.I need to obtain staff "account type" from my staff table and then define that account type in a variable.
View 1 RepliesI am getting a syntax error for the code below.I am trying to create a user in the mysql database and add their information to a datagrid control all in one button click using two statements; one to create the actual user, and one to add the user and their additional information to a table on the database and then refresh the datasource which will display the new user's information in the datagrid control.
If anyone knows where i went wrong please feel free to critique my code and let me know; or simply offer more efficient alternatives to what im hoping to achieve.
For those of you that must know, i am running the latest version of MySql server, MySql Workbench, and Visual Basic 2010 Express on a windows 7 based laptop. I'm writing this program in VB.net.
[Code]...
I want to create 1000 MySQL database on a hosting server & add 1 single user in all of them with all privileges enabled,Now I know how to create a database from MySQL query, But what I can not find is "how to add a user in the database",For example: create database 1a;This will create the database, but with the creation of the database I also want to add a user in that database from the same MySQL query, or another query to run with it, but I want both operation to run at the same time.
View 1 RepliesTrying to do a mysql parametrized query and i'm having a little issue.
cmd = conn.CreateCommand
cmd.CommandText = "insert into `rootforest` (rootforestname, BusinessName) VALUES (?rfname, ?bname)"
[Code]....
It errors on the executenonquery. Says the column rootforestname can not be null. i don't under stand why it does not fill in the value in the command text.
i have a column that i want to select from a table called style_number
each entry is listed as "something-stylenumber"
is there a way to strip everything from the - and to the left from the string when it is returned from mysql?
SELECT style_number FROM table1
I do not want to have to use vb.net to edit the returned string for each line that is pulled
i am trying to insert/save the listview item/s on the database.what i am trying to do now is if the product is being entered/saved for the first time.the fcode should be 1, and increments after that.i have a combo box and a text box.the combo box items are from the database [ product table ]
let say user choose product 1
and the list view has 2 items [ a, b ]
and then save
the table would look like
fcode -- prod_id -- prod_name -- item
1 1 product 1 a
1 1 product 1 b[code]......
My DATE field always display with time in vb.net is there a select query to format it into yyyy-MM-dd?
View 3 Replieshow to input data in mysql, different tables with one query?is it possible to do in gridview in vb.net 2008?
View 4 Repliesi'm trying to populate a simple combobox with a query to a MySql database. I Just want the combobox to show the results of the query:
SELET DISTINCT models from Cars
I am using VB 2008 with Datasets, how can I achieve this?
this is the code for my save button
Dim iCount As Integer
Dim iLoop As Integer
Dim query3 As New MySqlCommand
[Code]....
every time i hit save, there is no error but it does not save on my database.
here is my code
Dim lvitem
Dim iCount As Integer
Dim iLoop As Integer
[code].....
I am am currently developing an application using Visual Basic 2005 and I am also using the .NET MySQL Connector. I have noticed that when the MySQL Connector executes a query the application freezes for a bit so I was wondering if it is possible to create another application with textboxes, labels, etc, that will be hidden and will execute these queries, but the main application will be able to read and modify data on the hidden application so that it won't freeze.
View 18 RepliesI seem to be having a heck of a time trying to figure out how to add the results from a mySQL query to an array in vb.net. Right now, I only understand that you have to define the dimension of the array, however this is shy of impossible since the dimension of the array will change due to different results from the query. What is the proper way to take my results and put them in an array?
View 12 RepliesI have a basic calendar schedule i want to loop through and then do some checks. My first data reader works fine. But as soon as i put in the second data reader it does not finish.Here is my code
Dim mycommand As New MySqlCommand
Dim mycommand2 As New MySqlCommand
Dim myData As New DataTable[code].....
Basically the above code looks up distinct calendar entries in the database.i then loop through the entries and put the items in a list view.The code above will list about 1600 rows.in the above code if i uncomment the 2 lines the system will break It will on display one line of code. What im trying to do in the second query is to see if there are double bookings in the database.
I am trying to write a query on an .aspx webpage connected to an .aspx.vb file to access some parts information on my mysql server. Everything works fine except for one poorly named file, which keeps breaking the query. The fields name (with the table name in front) is
invf12.PRICEE(1STU_M)
Those brackets seem to be the problem. I have tried putting single quotes around them, as in
invf12.' PRICEE(1STU_M)',
I can't do anything about the fieldname. The query in total looks like this:
Protected Sub LookupPart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LookupPart.Click
Dim strSQL As String = "SELECT invf12.ITEMCODE as Part, invf02.DESCRIPTION as Description, " + _
"SUM(invf12.QUANTITYONHAND - invf12.QUANTITYRESERVED) as Available, invf12.PRICEE(1STU_M) as Price" + vbCrLf + _
"FROM invf12, invf02" + vbCrLf + _
[Code] .....
I have been coding an application for a LeaderBoard for a game. I have all the Login sorted using Mysql and even have all the Account infomation displaying in lables etc. for account info form. Now I am trying to UPDATE information and this is how I was trying to do this...
Dim UpdateInfo As New MySqlDataAdapter
Dim mycommand As New MySqlCommand()
Dim mydata As MySqlDataReader
Dim query = "UPDATE Login SET Pword = '" + UpdateTxtBox.Text + "' WHERE Uname = " + Login.Uname
mycommand.Connection = conn
mycommand.CommandText = query
UpdateInfo.SelectCommand = mycommand
mydata = mycommand.ExecuteReader()
But comes back with an Error saying... Unknown column 'username here' in 'where clause'. Now the username is in the database as I have just logged in with it and I am taking it I have the Query wrong somewhere.
I've spent a whole day on this already without figuring it out. I'm hoping somebody can help me translate the following MySQL query to work for SQL Server 2005:
SELECT MAX ( messages.date ) AS maxdate,
topics.id AS topicid, topics.*, users.*
FROM messages, topics, users WHERE messages.topic_id
= topics.id AND topics.user_id = users.id AND
topics.forum_id = " . $forumid . " GROUP BY
messages.topic_id ORDER BY maxdate DESC
$forumid is a QueryString value defined in the following VB.NET code-behind code:
forumName.Text = "<a href='ViewForum.aspx?forumid=" & row.id & "'>" & row.name & "</a>"
Dim lvitem As Object
Dim iCount As Integer
Dim iLoop As Integer
[code]....
That is my code. message box show up but the record is not saved in my database?