|
I want to develop a "multi datasource type" application (an aplication that should be able to querry more than one sql sever type - dbase, mysql, mssql, acces, excel)
Implementing my own communication drivers for dbase, acces, excel, and so on..., would be a waste of time in my opinion.
So my first question comes about an speed issue : whitch is faster, ado.net's odbc or ado.net's oledb? Meaning that the datasources I am facing are not at all small, having at least 30k rows (in the most favorable cases).
And the second question is about programatically driver detection : whether I use oledb or odbc, how can I find out progamatically if on a certain system the drivers neaded for a datasource type are present?
Thanx.
I hope I understand as quick as possible...because is a rough world out there...
|
|
|
|
|
Hi,
don't use ado.net odbc or ado.net oledb. U should use a managed provider for very database.
.NET 2.0 provides a buid-in ProviderFactory.
<br />
DbProviderFactory prov = DbProviderFactories.GetFactor("System.Data.SqlClient");<br />
DbConnection conn = provider.CreateConnection();<br />
conn.ConnectionString = CONNECTIONSTRING;<br />
conn.Open();<br />
If you want to use another database you should replace "System.Data.SqlClient".
'A programmer ist just a tool which converts caffeine into code'
|
|
|
|
|
Thank you for your advice, but my target is not .net v2.0.
I intend to build the application in .net v1.1.
The truth is that now I plan to build my own db factory, but I still don't know the answers to my initial questions...
I hope I understand...because is a rough world out there...
|
|
|
|
|
The fastest way is to use the speciallist classes for each database type. DotNetNuke implements its own data prodiver pattern you could look at for an example. Esentially there is an abstract base class and there are various concrete classes which use the appropriate specialist classes. To the user of the data provider there is no outward distinction between - it could as easily be calling Access as SQL Server. The results are returned as scalar values (int, bool, string, etc.) or through the IDataReader interface - so there is no need to know that is is an OleDbDataReader or SqlDataReader as they all expose the same interface.
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
You are right...
There are special clases designed especially for certain types of databases... these are the fastest...
T
he problem was that when no driver like the ones I wrote before are present, whitch is the best approch, Odbc or OleDb? The answer in most cases (if not all) is OleDb - a faster approach to databases..
Now another question still remains...
How can I find out programatically if a certain OleDb (or even Odbc) driver is installed - to be more specifically : how can I find out all the installed drivers?
I hope we understand...because is a rough world out there...
|
|
|
|
|
How can i use sql server for unicode supported language(urdu).As i insert records through query what it ends up
is just ?????
How to solve this problem.
|
|
|
|
|
Make sure you specify the correct collation when you install sql server
|
|
|
|
|
The font you are displying the results in doesn't support the characters you are putting in the database. Make sure your Windows settings and Sql Server settings are appropriate for displaying Urdu characters.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I need an urgent solution if anyone can help me
How to export sql serve 2000 database to a csv format.
|
|
|
|
|
Create a DataTable, fill it with sql data and
...
Sub DataTable2CSV(ByVal table As DataTable, ByVal filename As String)
DataTable2CSV(table, filename, vbTab)
End Sub
Sub DataTable2CSV(ByVal table As DataTable, ByVal filename As String, _
ByVal sepChar As String)
Dim writer As System.IO.StreamWriter
Try
writer = New System.IO.StreamWriter(filename)
' first write a line with the columns name
Dim sep As String = ""
Dim builder As New System.Text.StringBuilder
For Each col As DataColumn In table.Columns
builder.Append(sep).Append(col.ColumnName)
sep = sepChar
Next
writer.WriteLine(builder.ToString())
' then write all the rows
For Each row As DataRow In table.Rows
sep = ""
builder = New System.Text.StringBuilder
For Each col As DataColumn In table.Columns
builder.Append(sep).Append(row(col.ColumnName))
sep = sepChar
Next
writer.WriteLine(builder.ToString())
Next
Finally
If Not writer Is Nothing Then writer.Close()
End Try
End Sub
|
|
|
|
|
Hello everyone, I am working on this project, and I want to convert a VARCHAR into a BIT using the CONVERT function, but I cannot find any examples of this. If anyone can help, I would very much appreciate it.
This is what my code looks like
[code]
DROP PROC insertfarminginformation
GO
CREATE procedure insertfarminginformation
@FirstName varchar(50),
@LastName varchar(50),
@Address varchar(100),
@Address2 varchar(100),
@City varchar(50),
@State char(5),
@Zip varchar(10),
@Dup varchar(1),
@CASS varchar(1),
@DPV varchar(1)
as
CONVERT(BIT,@Dup)
CONVERT(BIT,@CASS)
CONVERT(BIT,@DPV)
insert into Farming_Information values (@FirstName, @LastName, @Address, @Address2, @City,
@State, @Zip,@Dup, @CASS, @DPV)
GO
[/code]
Thanks,
The Major Rager
-- modified at 20:52 Friday 21st October, 2005
|
|
|
|
|
You need to assign the return of the CONVERT function to a variable:
Sample:
declare @Dup varchar(1)
set @dup='1'
declare @b bit
Set @b=convert(Bit,@Dup)
Select @b
|
|
|
|
|
I have loaded a datatable from a SQL database and have bound it to a customized(through vs.net, not code) datagridview, which has textboxcolumns, checkboxcolumns, and one comboboxcolumn. My problem is this: In order to actually interact with the combobox in any column, the user has to click 3 times. Near as I can figure, these 3 clicks account for 1) selecting the datagridviewcell, 2) selecting the combobox in the datagridviewcell, and thirdly, actually opening the combobox for editing. Is there any way to speed this up so a click (I know its in column 5 of the datagridview) opens the combobox? I've tried the _onCellContentClick event handler, with casting the sender as a datagridviewcomboboxcell, but I could not see any quick way of selecting the combobox inside. Any ideas?
|
|
|
|
|
Hello guys,
I am writing a program that will read some data drom a *.mdb database file.
Suppose I have db2.mdb file and Table1 consists of next data
ID Name Surname<br />
<br />
1 nick Gates<br />
2 john Allen<br />
3 david Ellison
Now when I load this database in my application and for example delete the second record, in My Program the data is displayed(I use CListCtrl for displaying the data) in next way :
<br />
ID Name Surname<br />
<br />
1 nick Gates<br />
3 david Ellison
But I need that after deleting the second record , my program displayed it like this :
ID Name Surname<br />
<br />
1 nick Gates<br />
2 david Ellison<br />
As I guess After deleting the record I'll have to change the ID-s of all records in Database, and arrange them from beginning(1,2,3,..)
But I do not know how to do this , I am a beginner in Databases.
Can anyone help?
Thanks in advance
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 12:21 Friday 21st October, 2005
|
|
|
|
|
Not a good design - imagine if you have another table linked to that table on ID (like, say, customer contacts) then when John Allen leaves, David Ellison loses all his own contacts and gets John Allens ones instead?
Do a Google search on "E.F. Codd" and "Normalization" for more on this subject.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
I'm currently working on a project that use FileMaker Server and SQL Server 2000. On a button click, I sometime need to migrate data from SQL to FileMaker. So far everything is fine. But now the problem is with decimal values. Currently I just do a replace of (,) to (.). But FileMaker use . as a thousand separator ... So I try to send [34,78] as a value (the SQL statement is generated automatically and by no means we can use parameter), and the ODBC driver return an SQL Parser Error on this value.
So is there a way to send the (,) in an SQL statement without returning a parser error ?
Thank you very much !!
By the way, the ODBC driver is SEQUELINK 5.4
My Blog
-- modified at 11:15 Friday 21st October, 2005
|
|
|
|
|
I have created a database application that stores the thumbnails of images and videos on my system.I have used ADO.net and sql server for this.I want it to run on a system which doesnot have sql server installed.Can anyone help me to create a database without using sql servers.I have written the code in C#.
|
|
|
|
|
Hi,
unni_jeevan wrote: I have used ADO.net and sql server for this.I want it to run on a system which doesnot have sql server installed
Why don't you want to install the SQL-Server? There is a small version of SQL-Server2000 called MSDE. You can install this.
In Nov. MS will release SQL-Server2005 and the smaller version called SQL-Server2005 Expresss edtition. Take a look at this.
If u used a DataAcess-factory it is easy to switch to another database, which needs no installation, like FireBird embedded. In this case, the only thing you have to put with your application is a DLL and the database That's cool .
|
|
|
|
|
Hello guys,
I have a MFC dialog based application which Is loading some data from a *.mdb database file , but I have problems when I want to delete a record there .
Suppose we have next situtation. Table1 in my database file looks like this :
ID Name Surname<br />
1 nick Gates<br />
2 john Allen<br />
3 david Ellison
And I want to delete the secont record : 2 john Allen
So I am doing following :
void CMyDlg::OnDelete()
{
...
TRY
{
database.Open(NULL,false,false,sDsn);
CRecordset recset( &database );
SqlString.Format("DELETE from Table1 WHERE Name IS '%s'",sParam);
database.ExecuteSQL(SqlString);
}
CATCH(CDBException, e)
{
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
...
}
I get error Message Box : "Invalid use of IS Operator in expression 'Name IS john''"
Can anyone help what's wrong with the IS directive above??
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 9:41 Friday 21st October, 2005
|
|
|
|
|
Try
LIKE instead of IS. for eg DELETE from Table1 WHERE Name LIKE '%s'
Cheers!
<bold>Looney Tunezez
"If you build it....
.....BUGS will come!" -JB
Application.Run(new Form1(this.Dispose())); <--WHAT :wtf::confused::eek:
"Stability. What an interesting concept" - Chris Maunder
<bold>
|
|
|
|
|
thanks man it worked
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Looney Tunezez wrote: Application.Run(new Form1(this.Dispose()));
*ROFL* Where do you get this code?
|
|
|
|
|
Hi Guys!!pls help,
I'm having a public holiday table storing all public holidays,so whenever is a holiday is then displayed on a portlet on my home page,so I want that portlet to also appear notifying if the next day is a holiday,
how can I do that??
|
|
|
|
|
you can use a query like this (SQL Server):
Select holidaydate from tablename
where datediff(day,getdate(),modifieddate) in (0,1)
|
|
|
|
|
I'm getting lost pls clarify a bit more,or is there any Jscript that I can use?pls help,my problem is that I really dont know how to do it for example when is friday and Monday is a holiday,the portlet has to appear on friday notifying that monday is a holiday....,and when is tuesday and wednesday is aholiday is has to appear on tuesday...
|
|
|
|
|