Tag: asp.net

Issue regarding implementing SQL Dependency in Application_Start event

i through i will call SQL Dependency related code Application_Start event and my objective will be completed. my scenario is i have a routine in my web application which i invoke manually just clicking on a button when data updated in sql server table. i was told to make this process automated. so i go […]

Integrating Google Authentication in Existing Application

We have an application designed 3 years back in ASP.Net & SQL Server 2008. We designed our own login DB design and forms authentication for the application with the help of ApplicationUser, Role, Then other transaction tables using UserId for getting the corresponding user records, history records. So far no issues with new user registration […]

How to restrict authorization to controllers in ASP.NET MVC 4 app based on 'Admin' attribute in User database table

I have an ASP.NET MVC application which has two controllers – one will be used for all registered users (thus only users held within the User table in the database can access this controller) and another for admins (an admin is determined by a True value in the Admin attribute within the User table). Just […]

Update table 1 data to table 2

I used a SqlDataSource with this code for updating the data UPDATE [centreadmin] SET [centreadmin].centre = [centre].centre FROM [centre], [centreadmin] WHERE [centreadmin].centre = [centre].oldcentre But now I don’t want to use SqlDataSource. I tried this in .vb but without success. Protected Sub BtnUpdateAdmin_Click(sender As Object, e As EventArgs) Handles BtnUpdateAdmin.Click Dim connection As New SqlConnection() […]

Add data from database to Data Grid

I want to fetch data from sql server database and show it up in a Data grid view with edit and delete links how should I go about it?

The 'Vacancies' table in the database 'LiveDb' is not enabled for SQL cache notification

I am running an asp.net application and getting this error: The ‘Vacancies’ table in the database ‘LiveDb’ is not enabled for SQL cache notification. Please make sure the table exists, and the table name used for cache dependency matches exactly the table name used in cache notification registration. I tried this on command line: **C:\Users\myuser>C:\Windows\Microsoft.NET\Framework\v4.0.30319/aspnet_regsql.exe […]

Stored procedure call fails when called from asp.net web app but works when called from SSMS

Background: We recently had a project where we had to plot Institutions on a Google map however using the address to pinpoint the institution took way to long to load. Therefore we decided to store the lat/lng in the database against the institution record. To get this we created a Stored Procedure usp_web_kam_Geocode that calls […]

Synchronizing storaged data between web forms application and mobile client

Context: I have a web forms application using the Entity Framework to store objects in the SQL Server Express LocalDB. To work offline on a mobile client’s browser, i use a manifest file and need to synchronize the stored data. Approach: Like mentioned in this stackoverflow article, i could use the local storage of a […]

is this code vulnerable to SQL Injections?

page loads you have to fill some text boxes and then click add: tbSpyReports spyReport = new tbSpyReports(); spyReport.sgCityLevel = Convert.ToInt32(tbCityLevel.Text); spyReport.sgCityName = tbCityName_insert.Text; …. spyReport.insert(); Response.Redirect(Request.RawUrl); SqlConnection con = ikaConn.getConn(); SqlCommand command = new SqlCommand(“INSERT INTO spyReports(cityName, playerName, cityId, islandId, cordX, cordY, ” + “cityLevel, cityWall, cityWarehouse, Wood, Wine, Marble, Crystal, Sulfur, hasArmies) VALUES(” […]

Insert and Search Fields vb.net\asp.net web form to mssql

I’ve created a page that spits out data from a table. I’ve gotten the update and delete functionality, but I’m having trouble figuring out how to search and add values. I threw in a few text boxes to mess around with, but I don’t know how to make them into controls. I’d like to be […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.