Vandamn 0 Newbie Poster

I have written a windows service which is host to a WCF service and i connect to the WCF in vb.net by adding a service reference in vs2008.

the problem i have is that i need to connect to the WCF in javascript or jQuery (not bothered which). How do i do this?

The Windows service which hosts the WCF is written in a different project and is separate from my client application.

Any help would be great as i have spent hours on this and am getting nowhere fast.

Vandamn 0 Newbie Poster

Hey,glad to meet you all! I am a 51 year old male trying to get a handle on the workings of his pc. This seems a great place tp learn.

Hi Zerg59,
I am relatively new myself. Nice to meet you!

Vandamn 0 Newbie Poster

Does the ID contain characters as well as numbers, or invalid "white space" characters such as <space>.

If not can you post the code in cluding the Cint function.

Vandamn 0 Newbie Poster

Hi nanoh2001,

I believe your problem is the fact that you are trying to update all fields in your table with string values. If the fields in the table are not all strings then you will get the error you are geting.

I notice that there is a date field you are updating. If this field is a date field and the value you are supplying is not in a valid date format, then the error you are gettting will be generated.

Vandamn 0 Newbie Poster

Hi everettnewell,
have you thought of using the "CommandBuilder" command. The syntax of which for your problem would look something like:-

Imports MySql.Data.MySqlClient



Public Class Form1
    Dim str As String
    Dim conn As MySqlConnection
    Dim dr As DataRow
    Dim ds As DataSet
    Dim da As DataAdapter
    Dim cBuilder As CommandGuilder
    Dim sqlString As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Try

            str = " host = localhost ; username = 'root'; password = 'root'; database= asiawise; pooling = false;"
            conn = New MySqlConnection(str)
            conn.Open()

            ' This next line will create a table with no rows in it.
            sqlString = "SELECT * From students WHERE age = 999"
            da = New MySqlDataAdapter(sqlString, conn)
            ds = New DataSet()
            da.Fill(ds, "Students")
            dr = ds.Tables("Students").NewRow()

            dr.Item("last_name") = textbox1.text
            dr.Item("date_enrolled") = textbox3.text
            dr.Item("first_name") = textbox2.text
            dr.Item("category") = ComboBox1.text
            dr.Item("age") = 'textbox4.text'
            dr.Item("level") = ComboBox2.text
            dr.Item("mentor") = textbox5.text
            dr.Item("schedule") = ComboBox3.text

            cBuilder = New MySqlCommandBuilder(da)
            da.InsertCommand = cBuilder.GetInsertCommand()
            da.Update(ds)

            conn.Close()

        Catch ex As Exception
            MessageBox.Show("Connection has timedout.")

        End Try

    End Sub
End Class

I know this code works, i use this in one of my projects. I know that there is more code than you had originally, but i believe it will be a small price to pay if you can save the data.

Good Luck !

Vandamn 0 Newbie Poster

Hi...
I wrote code using vb.net
picturebox1.image=image.Fromfile("C:\a.jpg")
picturebox1 display image a.jpg.

if picturebox1 display, file a.jpg can't delete it because "being used by another person".
how to close picturebox1 so file a.jpg can delete?

i have tried to use picturebox1.dispose() and picturebox1.image=nothing but still can delete and display error message "being used by another person"

thanx

Hi,
you need to use :- PictureBox1.Image.Dispose() by using dispose on the picturebox, you are not disposing the image itself.

Vandamn 0 Newbie Poster

What method are you using to set the "fullname" variable. is this through a click event of say a button? or a keypress event from the textbox?

If there is no button event and there is no "keypress" event tied to the textbox, then how are you setting the variable "fullname"

Vandamn 0 Newbie Poster

First of all can i assume that you have set the file types in the save dialog?

If you have then you could check the extension and if the extension is ".c" then save as plain text or if the extension is ".rtf" then save as rich text format.

your code should follow this seudo code above and your function should save accordingly.

Vandamn 0 Newbie Poster

I want to validate text fields either carrying numbers or string that they should not be empty . how can i validate this before inserting data into database from form....

you can simply check the length of the text using for example TextBox1.TextLength and making sure that this is not 0

or your could use regular expressions. If you have not used these before google "Regular Expressions" and have a play

Vandamn 0 Newbie Poster

you cant do that with drag and drop toolbox controls. you need javascript file browser or asp.net file browser. search google with these.

Thanks Serkan,

will try this!

Vandamn 0 Newbie Poster

I think Teme64 is right!

how have you declared your variable "pictures" and where?

maybe from there it will give us further insight into how the variable has been dimensioned.

Vandamn 0 Newbie Poster

Hi maheen123,

if i have understood this properly, you have combo boxes with strings in them i.e. Female, Male and you want to insert a 1 if Female and a 2 if Male (for example) into the database.

if this is correct, then on the selectionchange of the combobox, read the text proprty and if Female write a 1 to the database table and a 2 if it is male (or whatever values you want to use).

i have some code for this if you require it?

Vandamn 0 Newbie Poster

I am trying to create a FileOpen Dialog for my website in C#, whereby i want the starting directory to be my images folder and only want to select .jpg, .png & .gif files. I also want the dialog box to return the address as though the root was my images folder i.e.

Images\Gallery\Wedding Photos\image1.jpg

can anyone help me?

Vandamn 0 Newbie Poster

Hi, i am new to the forum scene, but have been programming for approx 20 years in some form or other.

Name - Andy, Andrew(only when i've done something wrong)

Gender - Male

Height - 5' 10"

Hobbies - Reading fiction, badminton, chess, pc games

Likes - having a beer with my friends / family, watching fiveUS channel, playing pc games mainly tom clancy, chilling

Dislikes - untidyness, having to do the housework, washing the car