|
Hi Candy,
Try using an update query:
"UPDATE targetTable SET targetTable.targetColumn = NULL"
Where targetTable is the table that contains the column, targetColumn which is the column you want to delete the data from.
Jim
|
|
|
|
|
Oh yah! Thank you so much. :-> 
|
|
|
|
|
You can't get there from here...I always found that statement ironic. You hear it a lot when asking directions. It is like the problem I am having in creating a new Access database from ADO.NET programmatically.
First, you need a connection. This connection needs a connection string. The connection string has to have the path of the new database or it gripes about no Data Source. But when you put the new database name and path connection string it complains that the Data Source does not exist.
How do you do this? Any gurus know how to do this?
My plan was to:
OdbcConnection myConn = new OdbcConnection("Provider=blah..blah");
OdbcCommand myCommand = new OdbcCommand("CREATE DATABASE MyDbPath", myConn);
myComm.Open();
myCommand.ExecuteNonQuery();
...
How do you get there from here?
Thanks in advance!
-- modified at 22:48 Monday 19th June, 2006
|
|
|
|
|
Intriguing dilemma. I searched a little, and only came up with this:
http://support.microsoft.com/kb/317881/EN-US/[^]
The gist of it is that you need to use Microsoft ADO Ext. 2.7 for DDL and Security.
Build an Access Database
Open a new Visual C# .NET console application.
In Solution Explorer, right-click the References node and select Add Reference.
On the COM tab, select Microsoft ADO Ext. 2.7 for DDL and Security, click Select to add it to the Selected Components, and then click OK.
Delete all of the code from the code window for Class1.cs.
Paste the following code into the code window:
using System;
using ADOX;
namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
ADOX.CatalogClass cat = new ADOX.CatalogClass();
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=D:\\AccessDB\\NewMDB.mdb;" +
"Jet OLEDB:Engine Type=5");
Console.WriteLine("Database Created Successfully");
cat = null;
}
}
}
Change the path to the new .mdb file as appropriate, and then press F5 to build and run the project.
The new .mdb file will be created in Access 2000 (Jet 4.0) format.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thanks Eric.
That is a very inelegant solution. Looks like I am stuck with using it. Surprizing that there is not a better way. What if the end user does not have ADO 2.7 on his machine?
Great job finding that buddy! It confirms the problem and at least offers a solution, elegant or not.
Thanks again.
|
|
|
|
|
how to convert a string to integer of length 4?which function to use?
P.PaVaN KuMaR
|
|
|
|
|
select convert(int,ColumnName) from TableName
or
select cast(ColumnName as int) from TableName
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I would suggest to add the isnumeric function if you are not absolutely sure that the string ALWAYS contains valid ints:
select cast( case when isnumeric(ColumnName)=1 then ColumnName else NULL end as int ) from TableName
Regards,
Rainer.
Rainer Stropek
Visit my blog at http://www.cubido.at/rainers
|
|
|
|
|
r.stropek wrote: select cast( case when isnumeric(ColumnName)=1 then ColumnName else NULL end as int ) from TableName
Makes sense. Thanks.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
how to insert a boolean variable into sql table?it needs any conversion?give one example.
P.PaVaN KuMaR
|
|
|
|
|
|
i want a datetime format as mm/dd/yyyy in dataset i am getting
AcquisitionDate="2005-05-05T00:00:00+05:30"
if i used convert(datetime,AcquisitionDate) function ,the sql is throwing error convertion failed to datetime as character string
any other way to convert this
guide me please
-
|
|
|
|
|
It is too simple..
try this out...
--> convert(char,getdate(),101) <--function
....
vivek
|
|
|
|
|
I have a system which uses dynamic forms generated from XML, it saves the results in XML to a seperate table and combines the two on reload but I need a fast way of searching the XML and looking for suggestions, the data is stored like this:
<field name="<fieldname>" value="<somevalue>">
I was thinking of using something like:
SELECT * FROM xmldatatable WHERE xmldata LIKE 'value="%<searchterm>%"';
Would this be acceptable? I would imagine it would start to get very slow once the record numbers start increasing?
(Using PostgreSQL 8.1)
|
|
|
|
|
Have you thought about using XPath?
|
|
|
|
|
hi
i am writing a quert to select all the columns from a table just like that
select Eaton.* from Eaton
eaton is my table name but some colums has blank spacesin left and right so i want to eliminate them so i use
select Trim(Eaton.*) from Eaton but its not woking
Whast i do if any body know Please help
Thank in advance
Thanks
|
|
|
|
|
Use ltrim or rtrim
as below:
select lTRIM('Eaton.* ')
between (')
|
|
|
|
|
hi all...
i have a problem that how to show a date in access table.. can someone please help me..
areon25
|
|
|
|
|
Hi There
This has got to be an easy one... I am coming to ADO.NET from an ADO background, so i appologise if it comes across as totally stupid!
All i want to do is insert a new row into a table and pull back the autonumber primary key assigned to it.
What i don't want to have to do is:
1) Fill a Dataset in order to get a DataTable definition.
2) Use stored procedures.
Anybody know the answer off the top of their head? Guess i really need to buy a good ADO.NET book.
Thanks In Advance
Rich
|
|
|
|
|
|
this is my query
query="SELECT studenti.Nume, studenti.Prenume, cursuri.denumire_curs, note.nota, note.data " +
"FROM studenti INNER JOIN " +
"(profesori INNER JOIN " +
"(cursuri INNER JOIN [note] ON cursuri.id_curs = note.id_curs) " +
"ON profesori.id_profesor = cursuri.id_profesor) ON studenti.id_stud = note.id_stud " +
"WHERE profesori.user_name = '" + user + "'";
i want to give a name to the result table so i can put it in a DataSet
dadapter.Fill(ds,"table name");
Thanks
|
|
|
|
|
You don't need to know the name to put the results into a dataset. Just look at the overloads available.
|
|
|
|
|
In SQL Server: What is "ntext"? What is it for? How to use?
It is difficult for me to understand. A example will help me better.
For example: I have a Web page. I need display the content of news,include texts that larger than data type of ntext for a column.
What must I do now?
Thanks!
|
|
|
|
|
From bol
ntext: Variable-length Unicode data with a maximum length of 2^(30 - 1)(1,073,741,823) characters. Storage size, in bytes, is two times the number of characters entered. The SQL-92 synonym for ntext is national text.
If your news content will always be less than 8000 characters you can use varchar or nvarchar. Otherwise you will have to use text, ntext or image datatype.
http://msdn2.microsoft.com/en-us/library/ms190258.aspx[^]
http://msdn2.microsoft.com/en-us/library/ms191262.aspx[^]
--
Don't take life seriously because you can't come out of it alive.
-Warren Miller
(From Monty2[^] bio)
|
|
|
|
|
I am trying to creat a function in SQL Server where it returns a the value of a column in a table where the column is passed as a parameter.
Below is the function where I want to return the value in the user table for column @field. Thanks for your help.
CREATE FUNCTION [dbo].[USER_RETURNCOLUMN] (@userid decimal, @field varchar(200))
RETURNS varchar(2000)
AS
BEGIN
DECLARE @RETURNVALUE varchar(100)
SELECT @RETURNVALUE = ''
SELECT @RETURNVALUE = @field
FROM USER_TABLE
WHERE USER_ID = @userid
RETURN @RETURNVALUE
END
|
|
|
|