I have this code

Public Class Form1

    Private connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:/testn.mdb"
    Dim conn As New System.Data.OleDb.OleDbConnection(connectionstring)
    Dim cmd As New System.Data.OleDb.OleDbCommand

    Private ssql As String
    Dim dr As System.Data.OleDb.OleDbDataAdapter
   
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        conn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;data source=c:\nikhil\testn.mdb")
        conn.Open()


        Dim ssql As String = "insert into nikhil values( '1001','nikhil','99')"

        cmd = New System.Data.OleDb.OleDbCommand(ssql, conn)
        cmd.ExecuteNonQuery()
       


        conn.Close()

    End Sub


End Class

i wish to update data into table through a textbox. I tried using &textbox.text& but shows an error. I also want a combo box to do the same. also i wish to create a administrative username and password validation form. please help.

i used it like this

"insert into nikhil values(" & (TextBox1.Text) & ",'" & TextBox2.Text & "','" &_TextBox3.Text & "')"

sorry..its working


can anybody tell me however about user authentication

ok one more question. I am not able to connect to the server in sql server 2005 it is asking for server name in the authentication dialog box i put in computer name but not connecting

>inserting data through textbox

Use parametrized query.

....

Dim ssql As String = "insert into nikhil values (@p1,@p2,@p3)"
cmd = New System.Data.OleDb.OleDbCommand(ssql, conn)
cmd.Parameters.AddWithValue("@p1",textbox1.text)
cmd.Parameters.AddWithValue("@p2",textbox2.text)
cmd.Parameters.AddWithValue("@p3",textbox3.text)

conn.Open()
cmd.ExecuteNonQuery()
conn.Close()       
....

>I am not able to connect to the server in sql server 2005 it is asking for server name in the authentication dialog box i put in computer name but not connecting

Try using,

.\SQLEXPRESS

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.