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);
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:
staticvoid Main(string args)
ADOX.CatalogClass cat = new ADOX.CatalogClass();
"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
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?
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
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
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.