473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Update MDB where there's space in header

Hi,

My app updates mdb file with no probelm. the problem starts if there's
a space on a column name(header consists from two words). I tried all
sorts of things. here is my code:

private void button1_Click(object sender, System.EventArgs e)
{
string ColumnHeader = "DTV_DOWN MAC",updatestr="myupdate";
System.Data.OleDb.OleDbConnection con = null;
System.Data.OleDb.OleDbCommand command = null;
string filename = @"C:\test.mdb";
DataSet ds = new DataSet();
try
{
con = new
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
Source=" + filename);// + ";Extended
Properties=\"text;HDR=Yes;IMEX=1;FMT=Delimited\"") ;
string sql = "UPDATE DataTable SET '" + ColumnHeader + "' =
'"+updatestr+"' WHERE TBL_ID = 1980";
con.Open();
command = new OleDbCommand(sql,con);
int t = command.ExecuteNonQuery();
}
catch(Exception err)
{
MessageBox.Show(err.Message.ToString());
}
con.Close();
}

the exception occurs in line int "t = command.ExecuteNonQuery();".
i get error message "No value given for one or more requiered
parameter".
If i remove the space and use "_" in the mdb header and in
ColumnHeader,
it works. Can't I update MDB with space in header?

Thanks for the help.

Jan 10 '07 #1
2 2135
My app updates mdb file with no probelm. the problem starts if there's
a space on a column name(header consists from two words). I tried all
sorts of things. here is my code:
In Microsoft ( Access or SQL Server ) you can have spaces in your
column names, but then when you refer to them in a query, you have to
surround them with [ square brackets ].

Jan 10 '07 #2

ForrestPh...@gmail.com wrote:
My app updates mdb file with no probelm. the problem starts if there's
a space on a column name(header consists from two words). I tried all
sorts of things. here is my code:

In Microsoft ( Access or SQL Server ) you can have spaces in your
column names, but then when you refer to them in a query, you have to
surround them with [ square brackets ].
Thank you. God bless you. If my father was rich i would donate you :)

Jan 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas Kemmerich | last post by:
hi, i'm looking for a possibility to start a download. here is my current code: header("Content-Type: $_contenttype"); header("Content-Disposition: attachment; filename=\"$_filename\"");...
3
by: Tim Williams | last post by:
Hi. I'm starting to learn wxPython and for an exercise I'm writing a simple CSV file viewer. I just read in the CSV file and create a wx.Grid with the data. I'm using Python 2.3.2 with wxPython...
3
by: Nipon | last post by:
Hi, I am using MS SQL Server 7.0 SP2 in Windows 2000 server SP4. I have one-to-many tables (TABLE_HEAD and TABLE_DETAILS)which I am going to update by using a stored procedure with UPDATE...
21
by: Hattuari | last post by:
I'm learning C++ after having spent several years in the computer industry doing both system administration and engineering. I've written code in Perl, Bash, Pascal, Ada, C, Mathematica (hundreds...
24
by: ypjofficial | last post by:
Hello all, I have written a class with many private data members.and i am putting it in a separate dll file. Now when i link that file while writing my main program module,natuarally i have to...
0
by: Jochen Berninger | last post by:
I want to setup a new domain. For this I need a new hosting service (with a lot of web space). This web space / hosting service provider should offer a full package including Mail+Ftp server. Are...
16
by: wdh3rd | last post by:
Hi everyone. I'm new to C and I have a few questions: I am making files for permutations and combinations. Files to be made are perm.c, perm.h, combo.c, and combo.h. Since both combinations...
1
by: Esmi | last post by:
I am developing an application in Ms Excel 2003 that has a feature to update records in Ms Access. The problem is the table name I am trying to update contains a space and whenever I run the below...
7
by: tx9271 | last post by:
For some reason there is a gap in between some of my <divs>. It doesn't happen at the top to my header and navbar but once I go into my body it starts and I can't figure out why. any help would be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.