MySQL Connector /NET
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts
Page 1 of 1
I need some help with using the MySQL.Data.Client if anyone knows how to use it.
I am tryin an experiment with an CnS Add-In and I could use some help.
It is a basic Banner Rotator. I have a form on my server for uploading a 468x60 banner to the server and INSERT data into the database. But unlike in PHP where you can SELECT * FROM banners WHERE ID="$ID"; to get all the info in one shot, I havent been able to find a way todo that with the MySQL Connector.NET. From what I can tell the reader.read() can only see one column at a time and not all the columns information from a record without the ID in the first place.
I am using a ORDER BY RAN() LIMIT 0,1 to get the banner image data from the database but then I need to be able to click on the picturebox1 so the user can visit the banners website.
Ideas anyone?
I am tryin an experiment with an CnS Add-In and I could use some help.
It is a basic Banner Rotator. I have a form on my server for uploading a 468x60 banner to the server and INSERT data into the database. But unlike in PHP where you can SELECT * FROM banners WHERE ID="$ID"; to get all the info in one shot, I havent been able to find a way todo that with the MySQL Connector.NET. From what I can tell the reader.read() can only see one column at a time and not all the columns information from a record without the ID in the first place.
I am using a ORDER BY RAN() LIMIT 0,1 to get the banner image data from the database but then I need to be able to click on the picturebox1 so the user can visit the banners website.
Code: Select all
Then I just put
Public Sub GetBanners()
Try
Dim query As String = "SELECT * FROM banners ORDER BY RAND() LIMIT 0,1"
Dim connection As New MySqlConnection(connStr)
Dim cmd As New MySqlCommand(query, connection)
connection.Open()
Dim reader As MySqlDataReader
reader = cmd.ExecuteReader()
While reader.Read()
PictureBox1.Load("http://72.148.214.60/Media/Banners/Images/" + reader(3))
PictureBox1.SizeMode = Windows.Forms.PictureBoxSizeMode.StretchImage
End While
reader.Close()
connection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Code: Select all
in the UserControl1_Load Event. This works great. But I cant find away to make the banner clickable for the lack of a better word.GetBanners()
Ideas anyone?
Hello,
I dont know about the MySQL stuff but casirus is making something with the connector so perhaps he will know.
Cant you use the "PictureBox1_Click" event?. Like when you load the banner into the picturebox you also get the URL of where the banner goes too. Store it in a string or the PictureBox1.Tag then when the user clicks the picturebox use:
Hope that helps cooll;
I dont know about the MySQL stuff but casirus is making something with the connector so perhaps he will know.
Cant you use the "PictureBox1_Click" event?. Like when you load the banner into the picturebox you also get the URL of where the banner goes too. Store it in a string or the PictureBox1.Tag then when the user clicks the picturebox use:
Code: Select all
- To use the CnSDesktop browser or SlotAddin.Interaction.GoURL(PictureBox1.Tag.Tostring)
Code: Select all
to open the link in a seperate window.Process.Start(PictureBox1.Tag.Tostring)
Hope that helps cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
dude, great idea! I didnt think about that.
Just save the URL from the database to a setting then put the setting in the click event....so simple! Way cool!?!?!
Just save the URL from the database to a setting then put the setting in the click event....so simple! Way cool!?!?!
CodenStuff wrote:Hello,
I dont know about the MySQL stuff but casirus is making something with the connector so perhaps he will know.
Cant you use the "PictureBox1_Click" event?. Like when you load the banner into the picturebox you also get the URL of where the banner goes too. Store it in a string or the PictureBox1.Tag then when the user clicks the picturebox use:
Code: Select all- To use the CnSDesktop browser orSlotAddin.Interaction.GoURL(PictureBox1.Tag.Tostring)
Code: Select allto open the link in a seperate window.Process.Start(PictureBox1.Tag.Tostring)
Hope that helps cooll;
I tried using
Code: Select all
in the click event but it errored saying 'Interaction' is not a member of 'SlotAddin'SlotAddin.Interaction.GoURL(PictureBox1.Tag.Tostring)
so I ended up doing
Code: Select all
to open the users default browser. I hate that too. I would like it to open in the CnS Browser.Process.Start(My.Settings.bannerurl)
Now all I have todo is get the tooltip to show the Title and where good togo.
Hello,
I think you get that error because it using the old AppGlue.dll file, re-reference it using the AppGlue.dll file in your CNSDesktop folder because its been updated with new code.
I think you get that error because it using the old AppGlue.dll file, re-reference it using the AppGlue.dll file in your CNSDesktop folder because its been updated with new code.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
CodenStuff wrote:Hello,That did the trick. Thanks.
I think you get that error because it using the old AppGlue.dll file, re-reference it using the AppGlue.dll file in your CNSDesktop folder because its been updated with new code.
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023