Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all 3509 articles
Browse latest View live

ObjectDataSource OnInserted event to trap SQL INSERT/UPDATE errors not working in VWD 2010 at least in my system.

$
0
0

The event hancler below doesn't work in VWD 2010 Express. A duplicate data causes an error but it stops in the Business Logic Layer. It works fine in Visual Studio 2008. Please help if I am missing something?

Protected Sub ObjectDataSource1_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles ObjectDataSource1.Inserted
    If e.Exception IsNot Nothing Then
        If e.Exception.InnerException IsNot Nothing Then
            Label1.Text = e.Exception.InnerException.Message
            e.ExceptionHandled = True
        End If
    End If
End Sub

The ODS Control:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
    InsertMethod="InsertPerson" SelectMethod="GetPerson" TypeName="Person">
    <SelectParameters>
        <asp:QueryStringParameter Name="id" QueryStringField="id" Type="Int32" />
    </SelectParameters>
    <InsertParameters>
        <asp:Parameter Name="PersonName" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>

The BLL:

Public Class Person
    ...
    Public Shared Function InsertPerson(ByVal personName As String) As Integer
        Return SqlProvider.AddPerson(personName)
    End Function

    Public Shared Function GetPerson(ByVal id As Integer) As Person
        Return SqlProvider.GetPerson(id)
    End Function

End Class

The DAL:

Public Class SqlProvider
    Public Shared Function AddPerson(ByVal name As String) As Integer
        Dim cn As SqlConnection = New  SqlConnection( _
            ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim cmd As SqlCommand = New SqlCommand("INSERT INTO person(name) VALUES(@name)", cn)
        cmd.Parameters.AddWithValue("@name", name)
        cn.Open()
        Return cmd.ExecuteNonQuery()
    End Function
    ...
End Class

Execution stops in the line (DAL):

Return cmd.ExecuteNonQuery()

PLEASE HELP! I'm stuck!


email of new achievement

$
0
0

Assume the launch of Visual Studio new version later to 2012 is published in announcements. This article marked for reading or refer needs often. After a span of time it gets moved to archival but search from archival is the motto for the user as me to avoid instead. So i perfer to take this article either to email store of send a email to friend like of facility. is this available and my awareness to this is not yet. 

Help me in regards.

Can I test & debug EVERYTHING within VWD 2010, compare to a real server?

$
0
0

HI,

This is probably a very basic question, but I'd like to get a confirmation from someone more experienced.

I'm using Visual Web Developer 2010 right now, developing, testing and debugging some web projects, using VWD's built-in web server; along with SQL server 2008 express on the same computer.

My question is: will I be able to test & debug everything in VWD, just the same as I deploy the code + DB onto a "real" web server? IS there any limitation that I can not do in VWD, where can do on a real server (e.g. WIndows 2008+ IIS 7 + SQL server 2008)?

F.G.: Part of the reason I'm asking is: in an app, there is code like this:

HttpContext.Current.Session["mySessionVar1"] ...

or:

if (this.User.Identity.IsAuthenticated)
{  .....

or:

this.Session["..."]...

Can these code be executed just like on a web server?

Thanks,

CLaudia

Error while creating table from Server Explorer in VS 2010

$
0
0

I have SQL server 2008 R2 Express installed on my machine. I am developing a data driven application and want to have database cerated in the App_data folder in Web application. I was able to create a database but when I amtrying to create table or any other objects it is giving me following error.

Unable to save object because the object type is not supported.  This editor can only manipulate triggers, stored procedures or functions.

Please suggest whats missing.

Thanks,

Visual studio 2012 and database project (CLR)

$
0
0

Hi, we have a project written in vs2010 using database clr, we call a webservice with this application and it works great.

But now we have upgraded to vs2012 and it seems like we cant add service/web reference to the project anymore...

Is this something that has been removed from this type of project or are we missing something?

Option for connecting to Access DB with Password.

$
0
0

Hi All,

I am using Visual Web Developer Express 2010. It is running on Server 2003 with ASP 4.

As I add my gridview and choose my datasource (which is a password protected mdb file) it connects just fine. It does ask me for the password twice through out the process. I enter it and I do perform the test query option and all seems fine.

However, once I test the page in the browser I receive a rude error page stating: "[OleDbException (0x80040e4d): Not a valid password.]"

I am guessing that the password I entered during the setup of the datasource is not being saved. How do I enter in the password so the form keeps it? Web.config or code? I have went crossed eyed searching for this with VWD Express.

Any help would be great.

Thank you.

Can I link tasks to specific locations in code?

$
0
0

Hi,

In VS 2012, is there a way for me to create a task and link it to, say, line 350 in an action method in a controller?

The idea is to create tasks for people in my team where they can open their tasks and by clicking a link, they can get to the section in the code where they need to do their work.

What is the correct way to move project from website to my laptop?

$
0
0

Ok I'm going to admit defeat and post a question. I know various people have asked this in various ways but it's taking forever piecing everything together.

Task: To download source files from website and get it up and running on my machine so I can develop it.

General question: Have I done this right?

a. I created a new MVC 4 blank project then used File menu > Add website to add the files that I downloaded.

b. Then I pressed rebuild all

Should I have editted a config file first?

Specific question

I'm getting the error Error  Could not load type 'MyWebsiteName.MvcApplication'.  on this bit of code:

<%@ Application Codebehind="Global.asax.cs" Inherits="MyWebsiteName.MvcApplication" Language="C#" %>

I'm sure it is something simple that I need to do so am looking for these tips to ensure I can deal with this and any further problems I'm likely to encounter.



VS2012 Hangs on Add => Controller... When Project Originates from VS2010

$
0
0

Have two computers at home. One has VS2012 installed, and the other has VS2010 SP1. Started an MVC4 project on VS2010 and later opened the solution in VS2012 to continue working on it. When I right-click on the Controllers folder and selected Add => Controller... from the context menu VS2012 freezes. The only way to get to continue is to open the Task Manager and terminate the process.

I can work around the problem by selecting Add => New Item... and selecting MVC 4 Controller, but then I loose the scaffolding that the wizard produces.

Another work around is to create a new solution in VS2012, then add all the code files from the original project as Exising Items. I can then utilize the Add => Controller... wizard.

Has anyone else experienced this behavior? If so, please visit https://connect.microsoft.com/VisualStudio/feedback/details/763452/vs2012-hangs-on-add-controller-when-project-originated-from-vs2010-express to Up Vote and click the "Me Too" link.

 

Problems with VS 2012 - intellisense and MVC4

$
0
0

Greetings,

Installed VS 2012 Express. I very very carefully studied the video at http://www.asp.net/vnext/overview/videos/aspnet-mvc-4 and tried to go through it.

First off, Intellisense will show "prop", but there seems to be no way to get it to fill in the property snippet. Tab, Cntl Space, a bunch of other fail. Any suggestions?

Then, I made the model as told. I added a controller. In the setup pane, it showed the Model Class as expected and I selected it. It showed the Data Context Class as expected and I selected it. When I select Add, I get the message "Unsupported Context Type". Any suggestions?

VS 2012 looks great from the videos, but I haven't gotten far.

T'anks, Mike

How can I get intellisense to work in my razor view again?

$
0
0
So I installed a trial version of Windows 8 and found among other things that my Web Developer Express 2010 kept crashing. So in un-installed and re-installed Web Developer Express 2010. Now I notice that the views (the cshtml files) no longer have the familiar intellisense. Also the razor view code doesn't have any color for the special text and characters like '@'. Is there a package that I can install to get the intellisense back?

changing the view of VS 2012

$
0
0

Hello guys,

is it possible to change the layout of the view of the new visual studio 2012 to look similar to previous versions or a simple 3D view ???

Instead of the dull present outlook

many thanks

Ehi

VS2012 + ASP.NET MVC4 + Performance Profiling = sn.exe cannot be found; Path mangled by VS2012

$
0
0

Hello,

I have been struggling with this issue for a few hours, and have made no progress...  All I want to do is profile my ASP.NET MVC4 application using my VS2012 Premium Edition's built-in performance monitoring.  All of my projects are signed, so I need to define a post profiling sn.exe on the assemblies.  No problem...  I determined the path to sn.exe and copied the path into the following command.  I did the same to find the dll that needs to be signed...  And the same to find our .snk file.  The end result is the following:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\sn.exe" -R "C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll" "C:\PROJECTS\ABOH\Authenticode\abohcert.snk"

I enter this command into target's properties in the Performance Explorer for the aforementioned assembly.  I save it.  I open it, and it is the same...  I run Analyze->Start Performance Analysis.  It tells me that I have to restart vs2012 as Admin.  I say okay...  I run Analyze->Start Performance Analysis, and I get the following error.  Basically, VS2012 has changed the path that I provided to sn.exe, so it fails.  I have tried every conceivable
variation on the command.  Whitespace, nope, using quotes...  Path correct, yup... Etc...  I hope that someone can clue me in as to what is wrong.  Oh!  In case it matters, the working directory in the properties where I am setting the command is the following:

C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\bin\Debug\

My development computer is Win7 64-bit.

Thank you for your time and help,

Mike


------------------------------
Preparing web server for profiling
Profiling started.
Instrumenting C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x86
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
   C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll --> C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll
Original file backed up to C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll.orig
Warning VSP2001: C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll is a strongly named assembly.  It will need to be re-signed before it can be executed.
Successfully instrumented file C:\PROJECTS\ETMVC\ABitOfHelp.CultureNameDomain\obj\Debug\ABitOfHelp.CultureNameDomain.dll.
Warning VSP2013: Instrumenting this image requires it to run as a 32-bit process.  The CLR header flags have been updated to reflect this.
Running Post-Instrument Step
PRF0003: : Executable file not found (..\..\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\sn.exe).
PRF0028: Launch was aborted.  The instrumentation step 'Running Post-Instrument Step' returned an error (-1).
-------------------------------

capturing Windows username

$
0
0

I have built a web app using Visual Studio 2010 (Ver 10.0.40219.1 SP1 Rel) .Net 4.0

On my site master page I want to display the current user's windows Id.

When I run the app from my workstation the userID is display as expected.

However when I deploy it to my web server (WS2003 / IIS6), The UserID is displayed as NETWORK SERVICE.

I have set Integrated Windows authentication ON.

What am I missing?

Here is the code I am using:

in GLOBAL.asax.cs

protected void UserID()
{

string[] strSplitArr = System.Web.HttpContext.Current.User.Identity.Name.ToString().Split('\\'); // used for remote user (via web server)
if (strSplitArr.Length == 1)
{
System.Security.Principal.WindowsIdentity user;
user = System.Security.Principal.WindowsIdentity.GetCurrent();
SaveCookie("ABKUser", user.Name.ToUpper());
strSplitArr = user.Name.ToUpper().Split('\\'); // user is local (when testing)
}

AXTEST.Global.UserID = strSplitArr[1];

Publishing puts files/folders in "bin" directory instead of "root"?

$
0
0

Hi All: I just ran into an issue where a website I'm publishing using webdeploy from VS2010 is putting certain folders/files in the bin diretory instead of the root of the website where they exist. It used to put them in the correct place...not sure what I changed to create this behavior?

The folder in question has PDFs in it...if I drag a PDF from Windows Explorer into Solution Explorer it copies it into the project, but the default "build action" for the PDF is "do not copy"...if I manually change it "copy if newer" it does upload the PDF when I publish.

my output log shows:

Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Start Web Deploy Publish the Application/package to https://[website]:8172/msdeploy.axd?site=forms ...
Updating setAcl (forms).
Updating setAcl (forms).
Updating filePath (forms\bin\forms.dll).
Updating filePath (forms\bin\forms.pdb).
Updating filePath (forms\bin\forms.xml).
Adding child filePath (forms\bin\pdfTemplates\Kit.pdf).
Updating setAcl (forms).
Updating setAcl (forms).
Publish is successfully deployed.


the folder "pdfTemplates" is in the root of the project...but I see it now in the "bin" directory as well...what is causing it to be placed there?


Delay Notification

$
0
0

Hello All!

I have started getting this really annoying problem with VS 2005. Quite often when I run a website with visual studio when I have pressed stop, although it looks like it has thoroughly stopped when I try and do anything I get a "Delay Notification" pop up saying: that its waiting for an operation to complete and contact Microsoft if I encounter this problem often.

I used to only get this as I said above when I had just run a website but now its also happening when I just try and open another page, this time however (the reason I was prompted to post this) is that it has happened for no apparent reason! All I did was minimise Visual Studio and go to one of my folders and when I came back I got this "Delay Notification"

The major problem is that no matter which button I press (either "Switch to" or "Continue Waiting") or how ever long I wait it wont go away! I have to restart Visual Studio using ctrl alt delete and if I haven't just saved my work I lose it!

I occasionally get this problem with SQL server 2005 as well but not nearly as often as I am getting it with Visual Studio!

Has any one got any suggestions what I can do to stop this happening?
Or could it be something to do with my actual computer?

Any help would be much appreciated!

Thanks

Becky

 

Set IIS to use Pass through authentication but SQL Server login is showing NT Authority\System

$
0
0

Hi, 

I am new to ASP.net, I build a web based tool to allow users to modify and insert data on a table.  I set up both the IIS and SQL Server access to Windows Authentication.  I  also add a column that will register the user who modifed or inserted the data.  It works but when I publish it, I can see my user id on the website but when I tried to edit a column the Modified by field showed NT AUTHORITY\System.  I also tried see if the IIS authentication pass through the SQL server by disabling my team mate's account and let him modifed a column and it still let him.

I don't know much about C# coding so I thought to make it simple by letting the access control be on the SQL Server side.  If the NT user is not added as as user on the SQL server, he should be able to edit or insert data.

Any help will be appreciated.

Visual Web Developer VB Getting Data Counts from SQL after Textbox Entries submitted

$
0
0

Everyone has been helpful during this learning process, Thanks!

I am not even sure this is doable or even how to start the code! Can anyone please point me in the right direction. I have searched everything I can on this but nothing seems to fit what I want to do.

I have 4 textboxes as listed below. This is in VB.Net behind a Webpage

Textbox1 = PalletID (max count for PalletID # = 90)

Textbox 2 = CartonID (max count for CartonID # = 5)

Textbox 3 = PartID           Textbox 4 = PartSN

On enter - Textbox1, Textbox2, Textbox3, Textbox4, sends Textbox data to SQL database and then Textbox3.focus
Textbox1 & Textbox2 retains current data.
The code I have for the above is working!

I want to add these operations to the code
(how I want it to happen)

From the SQL Database
When Textbox2 current value count = 5 Then Textbox2 Clears and Textbox2.Focus
When Textbox1 current value count = 90 Then Textbox1 & Textbox2 Clears and Textbox1.focus
Then repeats for another pallet.

Asp.Net Visual Studio 2010 Professional

$
0
0

Hi,  

 I am new and testing MVC.  It was working fine but I dont know from yesterday onwards my VS 2010 Professional  stop working when ever I tried to debug any solution, it's not loading any thing and when I am trying to close Visual Studio, It gets hang.  

    I dont know where problem is ? anyone can help me with it ??      

 Thanks in Advance

Hang System VS 2005 VB.NET

$
0
0

WHEN I Run my system it's Hang ,no show gridview(data) ,no complete run

please help me

Viewing all 3509 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>