Subscribe: ASP.NET Forums
Added By: Feedage Forager Feedage Grade B rated
Language: English
button  chooseright  database  dbo  entity  insert smartsearchnewqa  null  postingdate  smartsearchnewqa dbo  string  values wshk  wshk 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: ASP.NET Forums

All Forums

All Forums

Last Build Date: Tue, 23 Jan 2018 08:23:14 -0800


Question about Roles and AD


Hi there,

In my MVC application, I'm using local AD to authenticate users which is working fine. Now I want to create Roles like Admin and Super Admin. Can someone give me an idea how  can I accomplish this. Can I use Identity? Do I need ApplicationUserManager since I'm not going to store AD password in the database?


Compare two tables and fill the fromdate and todate columns.


hi, I would like to fill the fromdate and Todate dates of the UniqueConsumption2 table fromdate = Postingdate column value of table UniqueConsumption2  Todate = Next availaible postingdate column value of table UniqueConsumption2  last todate of the material will be the next available postingdate from the second table Productionorder. Any help  on generation of script for the below is appreciated  Script below for creating the tables and data. /****** Object: Table [dbo].[UniqueConsumption2] Script Date: 01/22/2018 14:17:40 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[UniqueConsumption2]( [ID] [int] IDENTITY(1,1) NOT NULL, [SourceNo] [varchar](50) NULL, [OrderNO] [varchar](50) NULL, [Quantity] [decimal](18, 4) NULL, [PostingDate] [datetime] NULL, [ItemNo] [varchar](50) NULL, [FromDate] [datetime] NULL, [ToDate] [datetime] NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO CREATE TABLE [dbo].[ProductionOrder]( [ID] [numeric](18, 0) IDENTITY(1,1) NOT NULL, [PostingDate] [datetime] NOT NULL, [MaterialNumber] [nvarchar](256) NULL ) ON [PRIMARY] GO -- Insert queries------------ INSERT INTO [dbo].[UniqueConsumption2] ([SourceNo] ,[OrderNO] ,[Quantity] ,[PostingDate] ,[ItemNo] ,[FromDate] ,[ToDate]) VALUES ('WSHK-075S' ,'131787' ,'2.0000' ,'2004-01-19 00:00:00.000' ,'HAST-075') INSERT INTO [SmartSearchNewQA].[dbo].[UniqueConsumption2] ([SourceNo] ,[OrderNO] ,[Quantity] ,[PostingDate] ,[ItemNo] ,[FromDate] ,[ToDate]) VALUES ('WSHK-075S' ,'131270' ,'2.0000' ,'2003-06-30 00:00:00.000' ,'HAST-075') INSERT INTO [SmartSearchNewQA].[dbo].[UniqueConsumption2] ([SourceNo] ,[OrderNO] ,[Quantity] ,[PostingDate] ,[ItemNo] ,[FromDate] ,[ToDate]) VALUES ('WSHK-075S' ,'130705' ,'2.0000' ,'2003-05-29 00:00:00.000' ,'HAST-075') INSERT INTO [SmartSearchNewQA].[dbo].[UniqueConsumption2] ([SourceNo] ,[OrderNO] ,[Quantity] ,[PostingDate] ,[ItemNo] ,[FromDate] ,[ToDate]) VALUES ('WSHK-075R' ,'130382' ,'2.0000' ,'2005-06-05 00:00:00.000' ,'HAR-075') INSERT INTO [SmartSearchNewQA].[dbo].[UniqueConsumption2] ([SourceNo] ,[OrderNO] ,[Quantity] ,[PostingDate] ,[ItemNo] ,[FromDate] ,[ToDate]) VALUES ('WSHK-075R' ,'130381' ,'2.0000' ,'2003-06-05 00:00:00.000' ,'HAR-075') INSERT INTO [SmartSearchNewQA].[dbo].[ProductionOrder] ([PostingDate], [MaterialNumber]) values ('WSHK-075S', '2011-05-29 00:00:00.000') INSERT INTO [SmartSearchNewQA].[dbo].[ProductionOrder] ([PostingDate], [MaterialNumber]) values ('WSHK-075S', '2003-07-29 00:00:00.000') INSERT INTO [SmartSearchNewQA].[dbo].[ProductionOrder] ([PostingDate], [MaterialNumber]) values ('WSHK-075S', '2003-08-29 00:00:00.000') INSERT INTO [SmartSearchNewQA].[dbo].[ProductionOrder] ([PostingDate], [MaterialNumber]) values ('WSHK-075R', '2006-05-29 00:00:00.000') INSERT INTO [SmartSearchNewQA].[dbo].[ProductionOrder] ([PostingDate], [MaterialNumber]) values ('WSHK-075R', '2003-05-29 00:00:00.000') Desired Output ID SourceNo ORderNO Quantity PostingDate ItemNo FromDate ToDate Comments 1 WSHK-075S 131787 2 1/19/04 12:00 AM HAST-075 1/19/04 12:00 AM 5/29/11 12:00 AM ToDate filled from Postingdate column of Productionorder table. 2 WSHK-075S 131270 2 6/30/03 12:00 AM HAST-075 6/30/03 12:00 AM 1/19/04 12:00 AM ToDate filled from Next FromDate column value  of UniqueConsumption2 table. 3 WSHK-075S 130705 2 5/29/03 12:00 AM HAST-075 5/29/03 12:00 AM 6/30/03 12:00 AM ToDate filled from Next FromDate column value  of UniqueConsumption2 table 4 WSHK-075R 130382 2 6/5/03 12:00 AM HAR-075 6/5/03 12:00 AM 6/5/05 12:00 AM ToDate filled fro[...]

How to delete self referencing table data using entityframework


I have a Category model with self reference 

public class Category
        public int Id { get; set; }

        public string Title { get; set; }

        public int? ParentId { get; set; }

        public Category Parent { get; set; }

        public virtual ICollection Children { get; set; }

        public virtual ICollection PostCategories { get; set; }

output all columns if a matching record is found in two tables



First of all, I am not sure which subforum to place this in, so Mods, feel free to move it.

I inherited a legacy access database based system from an old supplier to our business.  He no longer maintains it and I need to get all the data off.  Unfortunately it is not as easy as opening the tables and copy/paste into excel.  I wish it were...

Database name: subs.mdb
Table name: Clients
 - Contains all client details such as name, address, phone and email etc
Table name: Subs
 - Contains publication they are subscribed to, date of subscription, etc but no names

Both tables have a ClientID column which links the records together.  A matching ID in Clients and Subs tables will show me what publication a particular person is subscribed to.

I have over 19,000 records...

I need a way to output all the columns for each record if there is a matching ClientID in each table.  If there is not a matching ClientID, the record can be ignored.

I am somewhat familiar with very basic classic asp so that is why I thought of the forums for some guidance.  I have not used at all.

If anyone could offer some help I would very much appreciate it.

I do have a windows server online so I can test any solution offered.

Write a query with count function for same project number and any date in the current year??



i am trying to check a table which has two columns(one is project_num and another one is INSPECT_DATE ).  write a query to prevent insert the values if i have same project number and any INSPECT_DATE in the current year into oracle table. all i want to use count function, so that query can count for the same project and any date exist for the current year. from the below query what i need to do to get the column existing date from oracle database.

query = " select count(project_num) count from PHY_INSP_SCHEDULE where project_num='" & Ddl_proj.SelectedItem.Value & _

"' and INSPECT_DATE = dt.ToString(""yyyy-MM-dd"") "
If SavedAlready(query) > 0 Then
alert = " public ActionResult SelectCity(CityViewModel CityViewModel,string Search) { if (Search == "bycity") { .... ....

actionresult does not fire in this case.
when I change type="submit" actionresult works but my javascript does not work.

Exception : Entity Framework 6 on PostgreSQL


I have been developing ASP.NET MVC 4 application using PostGreSQL database. I'm stuck up with the below issue over a week. So, i need your valuable help on this.

Referenced Packages:

"Npgsql" - Npgsql is the opoen source .NET data provider for PostgreSQL.
"Npgsql for Entity Framework 6" - PostgreSQL provider for Entity Framework 6.
Below exception occurs when calling the SimpleMembership provider.

postgresql log:

2018-01-19 09:00:30 IST [14320]: [1-1] user=postgres,db=PatientScheduler,app=[unknown],client= ERROR: syntax error at or near "[" at character 14

2018-01-19 09:00:30 IST [14320]: [2-1] user=postgres,db=PatientScheduler,app=
[unknown],client= STATEMENT: CREATE TABLE [UserProfile]([UserId] int NOT NULL PRIMARY KEY IDENTITY, [UserName] nvarchar(56) NOT NULL UNIQUE)

Stack Trace:

[PostgresException (0x80004005): 42601: syntax error at or near "["] Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage) +311 Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode) +272 Npgsql.NpgsqlConnector.ReadExpecting() +29 Npgsql.NpgsqlDataReader.NextResultInternal() +296 Npgsql.NpgsqlDataReader.NextResult() +184 Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior) +906 Npgsql.NpgsqlCommand.ExecuteNonQueryInternal() +134 WebMatrix.Data.Database.Execute(String commandText, Object[] args) +129 WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded() +309 WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) +86 WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +88 PatientSchedulingSystem.Filters.SimpleMembershipInitializer..ctor() in d:\Projects\PatientSchedulingSystem\PatientSchedulingSystem\Filters\InitializeSimpleMembershipAttribute.cs:41

The Entity Framework is not generated scripts based on PostgreSQL standard.

Problem of finding the path of database table by odbc


Hello, how do you do ? I contact you because I've got a problem of using database by a web site. I use excel tables and ODBC driver. The error's message is : Exception Details: System.Data.Odbc.OdbcException: ERROR [42S02] [Microsoft][Pilote ODBC Excel] Le moteur de base de données Microsoft Jet n'a pas pu trouver l'objet 't_jp_localisation'. Assurez-vous que l'objet existe et que vous avez correctement saisi son nom et son chemin d'accès. Well, I'm certain that the ODBC parameters are good because the connection to the database is valid with the controls on a .aspx page but the sql controls and the connection to the tables as t_jp_localisation are not valid on the behind code pages .aspx.cs. The sample code is : Web.Config :       .aspx page :           // the connection and the query are valids.  .cs page :  protected void ValiderRegion(object sender, EventArgs e)         {             string StringDDL_Region_Selected = DDL_Region.SelectedValue;             if (StringDDL_Region_Selected != null)             {                 SqlDataSource3.SelectParameters.Clear();                 SqlDataSource3.SelectCommand = "SELECT T_JP_Localisation_NumDptEtDpt FROM [t_jp_localisation$] WHERE T_JP_Localisation_Region = ?RegionJ group by T_JP_Localisation_NumDptEtDpt";                 SqlDataSource3.SelectParameters.Add("?RegionJ", DDL_Region.SelectedValue);                 DDL_Departement.DataSourceID = "SqlDataSource3";                 DD[...]

IIS Worker Process High memory but low CPU


Hi, I have been facing an issue with IIS worker process consuming lot of memory in our windows server 2016 machine on Azure. We have two instances of web api deployed on IIS and for some reason it's holding on to some memory. In task manager, I see the worker process takes about 4gb memory and 0% cpu and I've verified that nothing is running on the background. FYI, I tried doing memory profiling in VS but I couldn't figure out why only it uses high memory but 0% CPU.  Most of the threads that I found online talks about worker process consuming high cpu and high memory  but in my case it's only the memory.

Adding rows based on user input


how i can add rows in table by user input, for example when a person input 5 in a field then 5 rows add to the table.
my project is a a page that a passenger wants to buy ticket ,and the person can add more passenger when input the number of passengers, then rows will be add automatically

Mysql EntityFramework issue - Specified key was too long; max key length is 3072 bytes



when i type:

$ dotnet ef database update

i get this error:

Specified key was too long; max key length is 3072 bytes

The table which cause this error is a built-in Microsoft table for user management:

CREATE TABLE `AspNetUserLogins` (
`LoginProvider` varchar(767) NOT NULL,
`ProviderKey` varchar(767) NOT NULL,
`ProviderDisplayName` text NULL,
`UserId` varchar(767) NOT NULL,
PRIMARY KEY (`LoginProvider`, `ProviderKey`),
CONSTRAINT `FK_AspNetUserLogins_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE

I tried to add this to OnModelCreating:

modelBuilder.Entity(entity => entity.Property(m => m.NormalizedEmail).HasMaxLength(200));
modelBuilder.Entity(entity => entity.Property(m => m.NormalizedUserName).HasMaxLength(200));
modelBuilder.Entity(entity => entity.Property(m => m.NormalizedName).HasMaxLength(200));
modelBuilder.Entitystring>>(entity => entity.Property(m => m.UserId).HasMaxLength(200));
modelBuilder.Entitystring>>(entity => entity.Property(m => m.UserId).HasMaxLength(200));
modelBuilder.Entitystring>>(entity => entity.Property(m => m.RoleId).HasMaxLength(200));
modelBuilder.Entitystring>>(entity => entity.Property(m => m.UserId).HasMaxLength(200));
modelBuilder.Entitystring>>(entity => entity.Property(m => m.UserId).HasMaxLength(200));
modelBuilder.Entitystring>>(entity => entity.Property(m => m.RoleId).HasMaxLength(200));

But it does not work anymore

Thanks for your help

Configure a New Virtual Directory and map to a New App pool


I have a Web application and I want to run Mypage.aspx on a different App Pool from that of the application,here it was suggested that we need to create a virtual directory and map MyPage.aspx ,then I can assign a new app pool to virtual directory,kindly share any documentation to do the same(mean create virtual directory on IIS and mapping Appool).

Best place to start


Hello! I'm looking for a bit of advice here.

I am creating a maintenance website for tracking vehicles in the shop, upcoming maintenance for them, parts for those vehicles, etc. I am using core MVC and Entity Framework with a SQL database. I have no experience with databases before. I have used a plug in that created all the Models for each table in the database along with all of the properties. It also created the context model. So from my understanding, what I need to do from here is basically figure out how to get information from the database, how to manipulate it, and then also how to update the info in the database.

My question is where do I start? Breaking everything down it seems like the smallest part to start with would be to go through each of the different models 1 by 1 and create all of the queries for each model.
For instance, for the Manufacture model, I would create a query to retrieve all of the information, then I would create a query to modify the number of vehicles we own under that manufacture, then I would create a query to adjust the amount of money we have spent with that manufacture. This makes sense to me, but I don't know if I'm thinking about this in the correct way.
Also, if it is correct, I don't know where to put these queries. 

Code to check all text boxes


I used code below to check all text boxes but never work.
What is wrong? (I want to force user to input data into all text boxes)

Private Sub ValidateTextBoxes()
For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is TextBox Then
Dim txtBox As TextBox = CType(ctrl, TextBox)
If txtBox.Text.Length = 0 Then
MsgBox("All fields are required")
Exit Sub
End If
End If
End Sub

delete a pdf file


The supervisor can create a pdf file from a database.

 The problem is after the file is created others user can access the pdf directly.

At url.pdf.

I want to murder url.pdf after 30 minutes.  Thus no one can access it since its does not live anymore.


I do not have any experience doing this any ideas and suggestions would help.


//create file code above

//open file

string path = ResolveClientUrl("~/Appraisal/" + Empl.SelectedValue + ".pdf");

                string encodedPath = System.Web.HttpUtility.JavaScriptStringEncode(path, true);


                ClientScript.RegisterStartupScript(this.GetType(), "open", "" + encodedPath + ", '_blank');", true);





            //delete file


            string location = Server.MapPath("~/Appraisal");

            string delFile = location + "/" + Empl.SelectedValue + ".pdf";






            catch (IOException iox)




Tracking WebAPI per session


I have a webapi and the auth is token based.  The api is using .net core 2.0 and thinking of using idenityserver4 for the token auth.

What we want to do is for each client that authenticates using their clientid/secret is to create lets say a shopping cart which they can use.  There are a few things to consider here.

First each time the client calls api token endpoint they get a cart.  This can happen many times per client.  Second they can terminate each cart by calling a singout endpoint.

My question here is, in a REST service what is the best way to handle this scenario.

Happy to clear up any questions.  Any advice appreciated. developers team - Remote position



We are a software development shop in India with amazing talent, our focus is US companies who need experience and people who can execute, not simply lower rates. Speaking of which, did you know our cost of living in India is really affordable. Although we do not provide cheap rates we are really affordable and especially if you compare us to hiring a firm or contractor in the US.

We know it is expensive and hard to find the talent you need. We are offering a different kind of engagement and if you are open to it, we would like to set up some time into your calendar for an initial exploratory conversation.

ARKA specializes in dotnet/React/AngularJS/Python/RoR and mobile technologies. We can build a complete product from scratch or we can augment your current team.

If you are interested discussing further we can connect over skype.

Looking forward to hear back from you.

Thanks  & Regards

Rahul Mathur Managing Director | ARKA Softwares11/61 | Kaveri Path | Mansarover | Jaipur | INDIA
Email :
Skype : arka.softwares
Mobile: +91-98290-80579 (IN), +1 214 329 1556 (US) 
Corporate Website:

how can I update column value before SaveChanges(); when ActionResult httpost run



how can I update column value before SaveChanges() when ActionResult httpost run

for this column:

Database.Tablolar.Kullanicilar.CreatedDate = DateTime.Now

(Sorry for my easy question, I am new here :) for mvc)

        public ActionResult Register(Kullanicilar kullanicilar)
            if (ModelState.IsValid)

                ViewBag.Message = kullanicilar.Adi + " " + kullanicilar.Soyadi + " kaydınız tamamlandı.";

            return View();


CREATE TABLE [dbo].[Kullanicilar] (
    [Id]             INT            IDENTITY (1, 1) NOT NULL,
    [Adi]            NVARCHAR (50)  NOT NULL,
    [CariKodu]       NVARCHAR (40)  NULL,
    [Cep]            NVARCHAR (15)  NOT NULL,
    [CreatedDate]    DATETIME2 (7)  NOT NULL,
    [CreatedUserId]  INT            NOT NULL,
    [Eposta]         NVARCHAR (MAX) NOT NULL,
    [Ip]             NVARCHAR (15)  NULL,
    [PicturedId]     INT            NOT NULL,
    [Session]        NVARCHAR (MAX) NULL,
    [SifreDogrulama] NVARCHAR (MAX) NOT NULL,
    [Sifresi]        NVARCHAR (MAX) NOT NULL,
    [Soyadi]         NVARCHAR (50)  NOT NULL,
    [UpdatedDate]    DATETIME2 (7)  NOT NULL,
    [UpdatedUserId]  INT            NOT NULL