Hope you can work this one out, and if not give me a shout mid-june and I will try to figure it out.
Here's the shout
I actually made it, but unfortunately have encountered a much bigger problem. The variables I am using are transformed to the lowest possible number the database tables can deal with (0 or 1 depending on "Allow Null" or not in the DB). NO mather what I set the variables to!
I have used messageboxes to check what is passed on to the Web Service, so im about 100% sure the right value goes into the WS. But from there, I have NO idea. I have looked and tried alot of different things in this code and spent abut 10 hours staring at it. But to no luck.
Have tried about 5 forums to ask for help, but no one answers. I'm really about to give ut the project I have used months on.
Hope you src666, or someone else can help me out!
Code in my plugin:Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim varPartyBit As Boolean = True
Dim varClubBit As Integer = 1
Dim varNumberOfElements As Integer = 2
varLocalTrackNameModified = "WILD BIRD"
varLocalArtistNameModified = "BIG BANG"
MessageBox.Show(varNumberOfElements & varPartyBit & varClubBit & varLocalTrackNameModified & varLocalArtistNameModified)
service.InsertTrackElement(varNumberOfElements, varPartyBit, varClubBit, varLocalTrackNameModified, varLocalArtistNameModified)
End Sub
As you can see, I have tried both with Integer and Boolean as the Bit variable values. The messagebox prints exactly what I have set the variables as.
It reads just as expected in the MessageBox. The right values for sure. But when passed over to the Web Service only 0 is set for the variable bit values.
I tried with both Integer and Boolean for the Bit variables. Both gives the same result: "0". And the variable varNumberOfElements always result in 1. No mather what I set it as.
The only thing actualy doing as supposed to is the String values and the varNumberOfElements!
Code in my Web Service:<WebMethod()> Public Function InsertTrackElement(ByVal varNumberOfElements As Integer, ByVal varPartyBit As Boolean, ByVal varClubBit As Integer, ByVal varLocalTrackNameModified As String, ByVal varLocalArtistNameModified As String) As Integer
trackElement("INSERT INTO TrackElement (ElementNumber, Party, Club, TrackNumber) SELECT " & varNumberOfElements + 1 & ", '" & varPartyBit & "', " & varClubBit & ", T.TrackNumber FROM Track T INNER JOIN Artist A ON (A.ArtistNumber = T.ArtistNumber) WHERE T.TrackName = '" & varLocalTrackNameModified & "' AND A.ArtistName = '" & varLocalArtistNameModified & "'")
End Function
Public Function trackElement(ByVal SQLQuery As String) As String
myCommand.CommandText = SQLQuery
myCommand.Connection.Open()
varScalarCount = Convert.ToInt32(myCommand.ExecuteScalar())
SQLconn.Close()
Return varScalarCount
End Function
For the ones of you that's not familiar with web services, there is not much to it. I'll try to explain my example.
The webmethod are called from the plugin. The plugin passes the variables over to the web service and the web service inserts the variables into the SQL query in the Web Method. The complete SQL query are then passed over to the trackElement function (set in front of the query in the web method). This function opens the connection and executes the SQL query/insert.
I THINK this is how it SHOULD have worked, but along the way the variables are screwed up.
Would be eternaly greatfull for any help and advice!
- Carl