Hi, hope you can help, i am quite new to this.

I need to know who to write data from several text boxes on a form to a sql database.

I have created the sql database on a localhost using myphp admin, i have created the connection in a module named as dbconnect()

i can try the connection and this connects fine, but unsure how to write the data from the texboxes to the database.

hope you can help.

thanks

Recommended Answers

All 3 Replies

What SQL database? MySQL? MS SQL?

Essentially all you need to do is pass a SQL statement to the server. With SQL Server it would be something like. Not sure what you're using, but it should be similar.. just with some different connection/command objects.

Dim sqlCnn As SqlConnection
        Dim sqlCmd As SqlCommand

        sqlCnn = New SqlConnection(<connection_string>)
        sqlCnn.Open()
        sqlCmd = New SqlCommand(<sql_statement>, sqlCnn)
        sqlCmd.Connection = sqlCnn
        sqlCmd.CommandText = inSQL
        sqlCmd.ExecuteNonQuery()

        sqlCmd = Nothing
        sqlCnn.Close()

Thanks all for replies, but managed to resolve this today, bit of surfing on the net and a ebook later.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.