DataRow, DataColumn and DataTable not found when converting from rc1 to rc2 - asp.net

Im converting my asp.net core project from rc1 to rc2. I am having trouble getting DataRow, DataColumn to work and now im getting this error on DataTables:
DataTable does not contain a constructor that contains 0 arguments;
I have already added these to the project.json file with no luck.
"System.Data.Common": "4.0.1-rc2-24027",
"System.Data.SqlClient": "4.1.0-rc2-24027"
Is there a work around?
Thanks

I'm facing the same issue as well. Funny thing is that Microsoft has ported the base layer i.e. DataTable but not the DataRow & DataColumn. See section "Considered for porting" at this link.
Depending on what you are dealing with, I guess we are forced to use List or something similar.
Do let me know if you were able to come up with a work-around.

Related

.resx not working with vb code

I am making an asp.net web application with vb coding behind. I found a code online for making a multilingual website, and as the original code is in C# I made a C# project to try it. Everything went fine. Now, I converted the code to VB to use it on the original project, and for some reason, the Debugging doesn't want to start, always throwing MissingManifestResourceException as an error. The resource files' Build Action is set to Embedded Resource, and the Code I am using is this:
Dim rm As ResourceManager
Dim ci As CultureInfo
Private Sub LoadString()
Thread.CurrentThread.CurrentCulture = New CultureInfo(Session("Lang").ToString())
rm = New ResourceManager("WebApplication6.App_GlobalResources.Lang", Assembly.GetExecutingAssembly())
ci = Thread.CurrentThread.CurrentCulture
NavigationMenu.Items(0).Text = rm.GetString("MenuItemDefault", ci)
NavigationMenu.Items(1).Text = rm.GetString("MenuItemAbout", ci)
End Sub
Where "Lang" is the name of the base Resource File. The files' name:
Lang.en-US.resx, Lang.es-ES.resx
The whole error looks like this:
MissingManifestResourceException was unhandled by user code
Could not find any resources appropriate for the
specified culture or the neutral culture. Make sure
"WebApplication6.App_GlobalResources.Lang.resources" was correctly embedded or linked into
assembly "WebApplication6" at compile time, or that all the satellite
assemblies required are loadable and fully signed."
Again, in C# the whole thing worked. This code is Placed in a function, which is called from the Load_Page form.
Thanks in advance for your help!
After spending hours trying to figure out, I found a solution.
What I did was replace this string:
rm = New ResourceManager("WebApplication6.App_GlobalResources.Lang", Assembly.GetExecutingAssembly())
With this one:
rm = New ResourceManager("WebApplication6.Lang", System.Reflection.Assembly.Load("WebApplication6"))
But removing "App_GlobalResources" from the original string also worked. So the other posible solution is:
rm = New ResourceManager("WebApplication6.Language", Assembly.GetExecutingAssembly())
After replacing the string I just left everything else as it is in the main post. Now everything's working fine.

Websphere & Tivoli: NPE while trying to create PDAuthorizationContext

I am getting the following error when I try to start my Application...
[java.lang.IllegalStateException: java.lang.NullPointerException^M
at com.tivoli.pd.jutil.kb$1.run(kb$1.java:41)^M
at java.security.AccessController.doPrivileged(AccessController.java:229
)^M
at com.tivoli.pd.jutil.kb.c(kb.java:141)^M
at com.tivoli.pd.jutil.kb.(kb.java:56)^M
at com.tivoli.pd.jutil.PDContext.(PDContext.java:76)^M
at com.tivoli.pd.jazn.PDAuthorizationContext.(PDAuthorizationConte
xt.java:66)^M
I double checked the config file was accessible and I could read it. The code I am using looks as follows...
aC = new PDAuthorizationContext(cFile);
Is there a way to get more information on what is causing the NPE?
More information!!!
After debuging a bit, it appears the issue comes from this code (they use progaurd so it is a little hard to be 100% confident)...
Certificate[] arrayOfCertificate1 = ((KeyStore)???).getCertificateChain("DefaultID");
//Throws Null pointer (presumably because array is null)
Certificate localCertificate1 = arrayOfCertificate1[0];
EVEN MORE INFO
This appears to be some kind of dependency conflict (guess), because if I just create a sample App using PDAuthorizationContext it works fine.
Problem was related to the PD.jar version that I was using. Although I thought I was using one version I was using another. This was because on version was registered in my WebSphere library (under build path in eclipse). Once the proper library was introduced everything worked.

ASP.NET: Errors in autogenerated .Designer.cs file for Model

I'm new to ASP.NET and having a problem with a tutorial.
I've created a new MVC4 Project in VS2012 Express for Web.
And I've added a SQL Database with 1 Table "Persons" and filled it with some random testdata:
Id int (primary key, is identity=true)
name varchar(50)
birthdate date
adam 01.01.2001
berta 02.02.2002
As a Model I've used ADO.NET Entity Data Model, named it "PersonsModel.edmx"
and used the Personsdatabase for it.
To see the PersonsModel.Designer.cs file, I activated "Codegeneration Status" to "Standard". Refreshed and clicked on the PersonsModel.Designer.cs file.
But in this file I've errors... So I wanted to use something like this in my controller:
HomeController.cs:
PersonsEntities1 db = new PersonsEntities();
db.person...
but it doesn't work, and I think(?) it's because of the errors in the .Designer.cs file.
PersonsModel.Designer.cs: e.g.:
public PersonsEntities1() : base("name=PersonsEntities1", "PersonsEntities1")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
errors in the base: ... line
and in ContextOptions.
Unfortunately I've no english VS, but it says something like:
The best accordance für the overloaded System.Data.Entity.DbContext(string, System.Data.Entity.Infrastructure.DbCompiledModel)-Method has some invalid arguments
And no definition found for "ContextOptions", there is no method "ContextOptions" which accepts "MvcApplication7.Models.PersonsEntities1" as a first argument.
I'm a bit confused, because I did it like in the tutorial explained.
I think this code is in error:
base("name=PersonsEntities1", "PersonsEntities1")
There is no constructor that takes two strings. Your second argument is supposed to be of type DbCompiledModel. (See here.)
Now, I don't know why your designer would produce code that can't compile, so I'm wondering whether you have the wrong version of Entity Framework installed.
Apparently the problem was VS2012. It all works with VS2010.
I've downloaded the installer again from asp.net/mvc and added Visual Web Developer 2010 Express. After installation of VS2010 and all dependencies I tried the tutorial again and all works fine now. No wrong code in the .Designer.cs file :).
Thanks a lot Ann L. for your support. Your hint (wrong version of Entity Framework installed) prompt me to try another VS version.
In addition I've to say: I also tried VS2012 Ultimate (complete DVD version) but it didn't help.

What is the equivalent of ASP(VB) Server.CreateObject("ADOX.Catalog") in ASP.net (VB.net)

Hi
I am trying to convert a asp page to asp.net.
I changed everything except this one line
Set dbC = Server.CreateObject("ADOX.Catalog")
Can anyone suggest an equivalent to this ADOX.Catalog in asp.net
This dbC is being used in the following way in asp
Set cm = Server.CreateObject("ADODB.Command")
cm.CommandText = Request("qry")
sN = Request("sN")
Set tmpTable = dbC.Tables(sN)
if NOT IsObject(tmpTable) then
dbC.Views.Append sN, cm
else
tmpTble.Command = cm
end if
Although I do not have direct experience, this article seems like it would be of assistance to you:
How To Retrieve Schema Information by Using GetOleDbSchemaTable and Visual C# .NET
Try adding a reference into your project called, Microsoft ADO ext.6.0 for DLL and security or something similar.
Once you add it, you'd be able to write code like:
Dim dbc as New ADOX.Catalog
Ps: Not answering from a windows m/c to verify. Got this from another forum post

Can't set up asp.net mvc 2 RC and spark view engine

Does omebody has ideas how to fix "Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary)'." exception. This solution doesn't work http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx.
Thans for all.
I had to download the spark view engine source code (http://sparkviewengine.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27600). Once I did that I went through each of the projects that had a reference to the 1.0 version of System.Web.Mvc assembly and updated to reference to point to System.Web.Mvc 2.0. From there you can build the solution (in visual studio) and you will find that a whole bunch of tests start to fail. You can attempt to fix them (by adding the additional TextWriter parameter you will find is now needed). You will also see that the SparkView.cs file complains about a missing parameter. In the Render method (line 100 of the source code I downloaded) I had to update the instantiation of the wrappedViewContext to look like this (add writer to the end of the list of parameters):
public void Render(ViewContext viewContext, TextWriter writer)
{
var wrappedHttpContext = new HttpContextWrapper(viewContext.HttpContext, this);
var wrappedViewContext = new ViewContext(
new ControllerContext(wrappedHttpContext, viewContext.RouteData, viewContext.Controller),
viewContext.View,
viewContext.ViewData,
viewContext.TempData,
writer); // <-- add the writer to the end of the list of parameters
...
}
Once the code is updated you can run the build.cmd script that is in the root of the source you downloaded. The build process will create a zip file in the build/dist folder. Take those new dll's and add them to your website. Things should work once again.
At the time of this answer, MVC 2 RC2 bits are available at sparkviewengine.codeplex.com
http://sparkviewengine.codeplex.com/releases/view/41143
It was actually Erik from the post mentioned by R0MANARMY who helped get those bits out there.
Looks like you can also download compiled binaries from here. As the post says, it isn't a final (or official) release, but at least it seems like the unit tests pass.

Resources