Well, glad I asked. The solution I finally discovered was here:
How do I configure SQL Server Express to allow remote tcp/ip connections on port 1433?
- Run SQL Server Configuration Manager.
- Go to SQL Server Network Configuration > Protocols for SQLEXPRESS.
- Make sure TCP/IP is enabled.
So far, so good, and entirely expected. But then:
- Right-click on TCP/IP and select Properties.
- Verify that, under IP2, the IP Address is set to the computer's IP address on the local subnet.
- Scroll down to IPAll.
- Make sure that TCP Dynamic Ports is blank. (Mine was set to some 5-digit port number.)
- Make sure that TCP Port is set to 1433. (Mine was blank.)
(Also, if you follow these steps, it's not necessary to enable SQL Server Browser, and you only need to allow port 1433, not 1434.)
These extra five steps are something I can't remember ever having had to do in a previous version of SQL Server, Express or otherwise. They appear to have been necessary because I'm using a named instance (myservername\SQLEXPRESS) on the server instead of a default instance. See here:
Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)
Well, not sure exactly what you're trying to do here, but an anonymous type != a Table object. The exception indicates you're trying to cast an IEnum of an anonymous type (a compiler-generated class with a weird name) to an IEnum of type Table.
You can't cast types willy nilly in C#. You can't, for instance, do this:
(Table)"Lol I'd like to be a table pls kthx"
You can't cast any type that isn't already a Table, or extends from Table, to a Table.
So what you're asking is impossible. You should probably take a step back and ask a more general question about what you're trying to accomplish.
Some more on anon types... They only really have meaning within the scope of the method in which they are defined. It appears you might be returning your anon type enumeration from a method call and then are attempting to sort. This won't work, as once the anonymous type leaves the method scope it is considered (at least by intellisense) to be an object and the only way to get at its properties is to use reflection.
If your example isn't just a simplified version, you could just skip the anon type altogether...
this.bindingSource.DataSource =
from row in db.Table
select row.Name + row.Num.ToString();
This is an IEnumerable, and can be queried thusly:
var query = from row in anotherBindingSource
where row.StartsWith("asd")
select row;
However it doesn't look like you're accomplishing much at all with this...
You cannot query anonymous types outside of the scope in which they are defined.
This works:
public void Worthless(Hurr hurr)
{
var query = from x in hurr select new { x.Durr };
var requery = from x in query where x.Durr == "lol" select x;
}
This does not:
public class Anonymous
{
public IEnumerable GetMyDurrs(Hurr hurr)
{
return from x in Hurr select new { x.Durr };
}
public IEnumerable WeedMyDurrs(Hurr hurr, string value)
{
// this won't compile
return from x in GetMyDurrs(hurr) where x.Durr == value select x;
}
}
The second example won't compile because the anonymous type was defined within another scope.
The only way to get this to work is to define a type.
public class Anonymous
{
public IEnumerable<Anonymous.MyDurr> GetMyDurrs(Hurr hurr)
{
return from x in Hurr select new MyDurr { Durr = x.Durr };
}
public IEnumerable<Anonymous.MyDurr> WeedMyDurrs(Hurr hurr, string value)
{
// this won't compile
return from x in GetMyDurrs(hurr) where x.Durr == value select x;
}
public class MyDurr { public string Durr {get;set;} }
}
Best Answer
I've recently bumped into this issue and it was very tricky to resolve. It looks like there was an undocumented change to the drivers used in the SQL 2016 RTM release, as I didn't strike these issues on the same machine when it had the RC3 build.
Anyway in case it helps, here are the setup steps I'm using (with thanks to Dan English for some tips):
Install Oracle drivers: Oracle Client 12c (32-bit) plus ODAC.
a. Download and unzip the following files from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-win64-download-2297732.html and http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html ):
i. winnt_12102_client32.zip
ii. ODAC112040Xcopy_32bit.zip
b. Run winnt_12102_client32\client32\setup.exe. For the Installation Type, choose Admin. For the installation location enter C:\Oracle\Oracle12. Accept other defaults.
c. Start a Command Prompt “As Administrator” and change directory (cd) to your ODAC112040Xcopy_32bit folder.
d. Enter the command: install.bat all C:\Oracle\Oracle12 odac
e. Copy the tnsnames.ora file from another machine to these folders:
i. C:\Oracle\Oracle12\network\admin
ii. C:\Oracle\Oracle12\product\12.1.0\client_1\network\admin
Install Oracle drivers: Oracle Client 12c (64-bit) plus ODAC.
a. Download and unzip the following files from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-win64-download-2297732.html and http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html ):
i. winx64_12102_client.zip
ii. ODAC121024Xcopy_x64.zip
b. Run winx64_12102_client\client\setup.exe. For the Installation Type, choose Admin. For the installation location enter C:\Oracle\Oracle12_x64. Accept other defaults.
c. Start a Command Prompt “As Administrator” and change directory (cd) to the C:\Software\Oracle Client\ODAC121024Xcopy_x64 folder.
d. Enter the command: install.bat all C:\Oracle\Oracle12_x64 odac
e. Copy the tnsnames.ora file from the K drive folder (see 4.a. above) to these folders:
i. C:\Oracle\Oracle12_x64\network\admin
ii. C:\Oracle\Oracle12_x64\product\12.1.0\client_1\network\admin
After all that, most SSRS components worked OK. The exception was the SSRS Portal where Data Source setup and Test worked OK, but (bizarely) running reports gives an error:
ORA-12154: TNS:could not resolve the connect identifier specified
Eventually I gave up on this and went with an EZCONNECT connection string: host:port/sid. I never liked TNSNAMES files anyway, so this was my excuse to kill them for good.