Update database problem

Results 1 to 2 of 2

Thread: Update database problem

  1. #1
    Join Date
    Dec 1969

    Default Update database problem

    I can&#039;t update the fields(number type) in the database. I just want to read the value in the textboxes and update the database using these values. Can you give me a helping hand?<BR><BR>The following is my code:<BR><BR>Dim objCon As New OleDb.OleDbConnection<BR> objCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<BR> "Data Source=" & Server.MapPath("./db/SAA.mdb")<BR> objCon.Open()<BR> Dim tempHour, tempMin As Integer<BR> tempHour = CType(Hour_tb.Text, Integer)<BR> tempMin = CType(Min_tb.Text, Integer)<BR> Dim objCom As New OleDb.OleDbCommand("UPDATE AttendanceRule SET AttendanceRule.[Hour] = " & tempHour & ", AttendanceRule.[Min] = " & tempMin & ";", objCon)<BR><BR> objCom.ExecuteNonQuery()<BR> objCom = Nothing<BR> objCon.Close()

  2. #2
    Join Date
    Dec 1969

    Default RE: Update database problem

    What makes you think that this is advanced? My guess is that putting this in the ASP.NET forum would have gotten you an answer almost immediately.<BR><BR>I can&#039;t say for VB.NET (because I don&#039;t use it), but certainly in C#.NET, you&#039;d have to convert those integers into strings before you could concatenate them:<BR><BR>Dim objCom As New OleDb.OleDbCommand("UPDATE AttendanceRule SET AttendanceRule.[Hour] = " & tempHour.ToString() & ", AttendanceRule.[Min] = " & tempMin.ToString() & ";", objCon)<BR><BR>Alternatively, you could actually post the error you get. Rather than making us just guess what&#039;s happening.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts