I use ASP.NET 4.6.1 in Windows Server 2008 r2 using Indexing Server.
I use Microsoft OLE DB Provider for Microsoft Indexing Service, same Provider MSIDXS
Now, I want use Windows Server 2012 r2.
Indexing Service is no longer supported as of Windows XP and is
unavailable for use as of Windows 8. Instead, use Windows Search for
client side search and Microsoft Search Server Express for server side
search.
How use using Microsoft Search in ASP.NET?
I'm confused: I use Windows Search Server or Windows Search Service ?
Which OLE DB provider is required ?
How install Windows Search Server ?
How install Windows Search Service ? (maybe feature in Windows 2012 R2)
Downloading and installing Windows Search Server does not install the
OLE DB provider. Neither does installing the Windows SDK. The provider
is installed when the Windows Search Service is installed.
On Win7/8 desktop OS, this is installed be default (I believe). On
server Windows Server 2012, you have to enable the feature.
My code using Indexing Server in Windows 2008 R2 + ASP.NET:
// Catalog Name
string strCatalog = txtNombreCatalogo.Text;
string strQuery = "";
strQuery = "Select DocTitle,Filename,Size,PATH,URL";
strQuery += ", DocAuthor, vpath, Write, Rank, Create, Characterization, DocCategory";
strQuery += " from Scope() where FREETEXT('" + txtNombreFichero.Text + "')";
// txtNombreFichero.Text is the word that you type in the text box to query by using Indexing Service.
string connstring = "Provider=MSIDXS;Integrated Security .='';Data Source=" + strCatalog;
//connstring = "Provider=MSIDXS.1;Integrated Security .='';Data Source=" + strCatalog;
var conn = new System.Data.OleDb.OleDbConnection(connstring);
conn.Open();
var cmd = new System.Data.OleDb.OleDbDataAdapter(strQuery, conn);
var testDataSet = new System.Data.DataSet();
cmd.Fill(testDataSet, "SearchResults");
DataView source = new DataView(testDataSet.Tables[0]);
dgResultados.DataSource = source;
dgResultados.DataBind();
I'm confused: I use Windows Search Server or Windows Search Service ?
You use Indexing search(https://msdn.microsoft.com/en-us/library/ee805985(v=vs.85).aspx).
Which OLE DB provider is required ?
For use Windows Search Service use "Provider=Search.CollatorDSO;Extended Properties='Application=Windows'; Data Source=(local);"
How install Windows Search Server ?
For use Windows Search Server you should download and install Microsoft Search Server(based on sharepoint) https://www.microsoft.com/en-us/download/details.aspx?id=18914.
Related
I was using the below code to connect to SQL Azure DB that was using Active Directory Integrated Authentication.
private string GenerateConnectionString(string databaseName, string serverName)
{
SqlConnectionStringBuilder connBuilder = new SqlConnectionStringBuilder();
sqlConnectionBuilder.DataSource = string.Format(
"tcp:{0}.database.windows.net",
serverName);
connBuilder.InitialCatalog = databaseName;
connBuilder.Authentication = SqlAuthenticationMethod.ActiveDirectoryIntegrated;
connBuilder.ConnectTimeout = 30;
return connBuilder.ConnectionString;
}
The authentication is changed from Active Directory Integrated Authentication to Active Directory Universal Authentication to support multi-factor authentication.
I see the enumeration
System.Data.SqlClient.SqlAuthenticationMethod doesn't have a value for Active Directory Universal Authentication. Is it possible to still use the System.Data.SqlClient to connect to the DB? If yes, what is
the change I have to do in the code?
ActiveDirectoryInteractive authentication method is available since the .NET Framework 4.7.2. Not sure if it is the same as "Universal" or not.
As of August 2020, there's a better way to connect to Azure SQL DB's or Azure Synapse DW (SQL pools). By using the MSOLEDBSQL driver (which you may redistribute along with your application), your application can perform interactive/MFA authentication using the normal System.Data.OleDb objects:
using System.Data.OleDb;
...
OleDbConnection con = new OleDbConnection("Provider=MSOLEDBSQL;Data Source=sqlserver.database.windows.net;User ID=user#domain.com;Initial Catalog=database;Authentication=ActiveDirectoryInteractive");
In fact, this is the recommended way of connecting to any Microsoft SQL product programatically, as both SQLOLEDB and SQLNCLI (aka. "SNAC") have been deprecated.
I develop a Windows C# application which can work in Online and Offline mode.
When in Online mode it connects to a SQL Server. In Offline mode it connects to a local DB.
I use the Microsoft Sync Framework 2.1 to sync the 2 databases on demand.
Until now I used a LocalDB instance of SQL Server as the local database. But it is a pain to setup the system automatically during the installation process of my application. So I tought to use SQL Server Compact 3.5 or 4.0 which is very easy to distribute (comes in a single file).
But I cannot get it to even compile the provisioning code of the Compact DB:
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("MyScope");
SqlCeConnection clientConn = new SqlCeConnection(OfflineConnectionString);
var clientProvision = new SqlCeSyncScopeProvisioning(clientConn, scopeDesc);
clientProvision.Apply();
which I used before (without the Ce classes) but SqlCeSyncScopeProvisioning cannot be resolved.
Something is terribly wrong here.
How can I sync my CompactDB to distribute this as my local database?
First ensure, you have successfully installed the sdk?
After this, make sure you have added the following references:
Microsoft.Synchronization.Data.dll,
Microsoft.Synchronization.Data.Server.dll
Microsoft.Synchronization.Data.SqlServer.dll
Microsoft.Synchronization.Data.SqlServerCe.dll
Also in my case it worked with adding
System.Data.SqlServerCe - 4.0
EDIT
Against your comment, this is only working if you use SQL Server CE 4.
I've tried it now with SQL Server CE 3.5 and indeed I could reproduce your issue.
Switching to SQL Server CE 4.0 fixed it.
ExampleTable 4.0
TestCode
var scopeDesc = new DbSyncScopeDescription("MyScope");
var tbl = new DbSyncTableDescription("TestTable");
var pkColumn = new DbSyncColumnDescription("Id", "int");
pkColumn.IsPrimaryKey = true;
tbl.Columns.Add(pkColumn);
tbl.Columns.Add(new DbSyncColumnDescription("Name", "nvarchar(254)"));
scopeDesc.Tables.Add(tbl);
var clientConn = new SqlCeConnection(#"Data Source=test.sdf;Persist Security Info=False;");
var clientProvision = new SqlCeSyncScopeProvisioning(clientConn, scopeDesc);
clientProvision.Apply();
Result
Everything compiles nicely. After following the above steps, you should be able to easily migrate your code to SQL Server CE
I've installed Windows Search Service feature on Windows 2012. Now I'm testing form which should send query from Windows 2008 to Windows 2012 catalog. Windows 2008 has the Windows Search service installed too to get db driver installed/registered.
The form works properly only locally on Windows 2012
but doesn't work from Windows 2008 to Windows 2012 (remote access to catalog), Wireshark doesn't show outgoing query.
Query to local catalog (success):
("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM SystemIndex WHERE SCOPE='file:C:/test'", SearchConnect);
Queries to remote catalog Windows 2008 > Windows 2012 (no success)
("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM MyServer.SystemIndex WHERE SCOPE='file:C:/test'", SearchConnect);
("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM SystemIndex WHERE SCOPE='file://MyServer/C:/test'", SearchConnect);
Part of code - only select is modified during testing
{
string connectionString = "Provider=Search.CollatorDSO.1;Extended Properties='Application=Windows'";
OleDbConnection SearchConnect = new OleDbConnection();
SearchConnect.ConnectionString = connectionString;
OleDbDataAdapter SearchAdpt = new OleDbDataAdapter("SELECT System.FileName,System.ItemPathDisplay,System.DateCreated FROM SystemIndex WHERE SCOPE='file:C:/test'", SearchConnect);
SearchAdpt.Fill(searchResults);
}
Reference
MSDN - SCOPE and DIRECTORY Predicates
You are asking your local server to start a search on your local system to be done by another server ...
Use your statement with
SELECT * FROM OPENQUERY(externalServer,'script') T
Translates in your case in:
"SELECT * FROM OPENQUERY(MyServer, ' SELECT System.FileName, System.ItemPathDisplay, System.DateCreated FROM SystemIndex WHERE SCOPE=''file:C:/test'' ') T"
I am using VisualStudio2008, I created a Smart Device Project; and i would like to create an application to update something to an access database. For example something similar to a Windows application:
string connection = Provider=Microsoft.JET.OLEDB.4.0;Data Source={0};Jet OLEDB:Database Password={1};
string password = "123456";
string path = #"C:\mydb.mdb";
OleDbConnection conn = new OleDbConnection(string.Format(connection, path, password));
There is the possibility of using the access database (.mdb) with Windows Mobile 6?
Thanks
As far as I know there is no support for Access databases in Windows Mobile. You would have to either use SQL Server Compact Edition or connect to an external database over the internet.
I am using 64-bit Windows Server 2008 with SQL Server 2008. And Using VS2008 + C# + .Net 2.0 + IIS 7.0 + ASP.Net. When executing the following statement, I met with the following error (the error occurs when accessing an aspx page), I am not sure whether it is 64-bit system specific issue?
Sys.WebForms.PageRequestManagerServerErrorException: unregistered OLE DB access interface "Microsoft.Jet.OLEDB.4.0"
StringBuilder sb = new StringBuilder();
sb.AppendLine("select * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 8.0;HDR=YES;DATABASE=" + s_path.Trim() + "',sheet1$) where name is not null"); //e:\\test1.xls
DataSet ds = SqlUtil.ExecuteDataset(Database.StrConn, CommandType.Text, sb.ToString());
if (ds.Tables[0].Rows.Count > 0)
{
GridView_Tlinkmans.DataSource = ds;
GridView_Tlinkmans.DataBind();
}
You have one or 2 issues:
You are querying OPENROWSET in SQL Server and you have x64 SQL Server, you may need the MDAC to bridge SQL Server to ODBC/OLEDB. However, this says it is part of the OS for Win 2008+. I've had to install on Win 2003
Then you probably need this which is the closest to JET I know of: Microsoft Access Database Engine 2010 Redistributable
YMMV