Ask Experts Questions for FREE Help !
    Mistery1's Avatar
    Mistery1 Posts: 39, Reputation: 1
    Junior Member

    Aug 4, 2009, 12:31 AM
    Imserting data at runtime in
    Hi there,

    Protected Sub ButtonSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSubmit.Click

    Dim cn As New OleDbConnection
    Dim str As String
    Dim cmd As New OleDbCommand

    cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Mistery1\Desktop\Emp.mdb;")

    Str = "INSERT INTO EmpNames(EmpNo, Ename, Department) VALUES(" & CInt(TextBoxEmpNo.Text) & ",'" & TextBoxEname.Text.Replace("'", "''") & "','" & TextBoxDepartment.Text.Replace("'", "''") & "')"

    cmd = New OleDbCommand(Str, cn)
    str = cmd.ExecuteNonQuery


    End sub

    I am trying to create a website using 2.0 and VB(not c#). The code above works perfectly when used as a windows application but not as a web application.

    Please could someone tell me where I'm going wrong. I don't get any errors, just NO entry in the database. I have googled but to no avail.

    Please help
    shatrughna's Avatar
    shatrughna Posts: 1, Reputation: 1
    New Member

    Nov 20, 2009, 03:52 AM

    Please try using sqldatasource and giving parameter value with ref. control, cookies method u will able to insert records

Not your question? Ask your question View similar questions


Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.

Check out some similar questions!

Data entry or data processing from home. [ 1 Answers ]

Hello from Florida, My name is Don and I am looking for a free data entry from home website that I can find. It is not easy to find! Please help!

Collect data into 2 combo boxes from data in an access table [ 1 Answers ]

I have two combo boxes. When the form loads the db connection opens a recordset that selects all the data from the retaillocations table. When you choose the region (0-4), that number loads into a text box and the Contacts load into the forst combo box. Now I want to select only the Name based on...

Transmitting data and receiving data wireless through moirco-controller [ 2 Answers ]

Hi I want to transmit data from one microcontroller to another microcontroller wirelessly. The micro-controller are connected to one computer each through a serial cable. I want it to transmit data from the hyper terminal to the 1st micro-controller. For example, when I type the letter "a", it...

Convert vista data or hd to xp data or hd [ 3 Answers ]

Had vista on PC - lost motherboard - replacement motherboard will not support vista. I have xp installed, but it will not recognize data from vista hard drive. Though I have my data files backed up on "carbonite", I don't know if they will restore to an XP hard drive? Else - is there...

Runtime error [ 1 Answers ]

On certain internet site I get popup message runtime error do you wish to debug yes or no? When I press yes I get another box coming up I then go into remote and then it says access denied what am I meant to to do with this annoying item:mad:

View more questions Search