1 Replies - 965 Views - Last Post: 15 August 2011 - 12:07 AM Rate Topic: -----

#1 Priyotosh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 11-August 11

How to add a blank value in a field in access database by vb 2008?

Posted 13 August 2011 - 01:48 PM

I want to add a blank value to a field in access database with vb 2008 command.

Problem 1:
Here is my code, it shows conversion to string not possible errors
Private Sub btnRedThrow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRedThrow.Click
Dim dbCnct As New DBUtills
dbCnct.InsertMethod("Insert into Score values (" + lblGameNo.Text + "," + lblRedThrow.Text + "," + lblRedPlayerID.Text + "," + btnRedDice.Text + "," + +")")
End Sub



notice the fifth and last value is empty. But it is not being added into the database, how do I do that?

Problem 2:
Why does an additional field from my access database disappear even after I manually created the field?? (access database 2003 version, extension is .mdb) I'm using visual studio 2008

This post has been edited by Priyotosh: 13 August 2011 - 01:52 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to add a blank value in a field in access database by vb 2008?

#2 Ionut  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 385
  • View blog
  • Posts: 1,057
  • Joined: 17-July 10

Re: How to add a blank value in a field in access database by vb 2008?

Posted 15 August 2011 - 12:07 AM

Can you show us your table schema? the problem is not from the blank values you try to insert. Note that a string value has to be enclosed in apostrophes (e.g. 'string value') in order to be correcly processed by the database engine. As I see from the error, you try to insert a invalid valid value to a field, so please post the schema.

For the second problem, I don't have an answer. Make sure that when you create a field, database is properly opened to accept changes. An access database can be opened in 4 states: Open, Open read-only, open Exclusive, Open Exclusive Read-Only.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1