Tag: asp.net

How to insert multiple rows into an database in C#/ADO.NET?

I’ve got a DataTable which has a number of records. I’ve tried the following code for iterating through the DataTable and inserting into the database, but I am receiving an error message saying that the parameters have not been declared: using (SqlCommand command = new SqlCommand((“My insert statement”), connection)) { SqlParameter param1 = new SqlParameter(); […]

How to setup single-code multiple-database ASP.NET SaaS application

I am building a SaaS application and I would like to retain the single code base I have. I would like to be in separate sub-domains cust1.saascompany.com, cust2.saascompany.com, etc. However, I don’t have any TenantID’s and would prefer for multiple reasons to stay with separate databases for each customer (primary one is that it’s already […]

Linq joined entity is null

I have some issues with date comparisons I’m working on that you will see in the code (how to do DateTime.Now.AddMonth(2) without a compile error would be nice to know), but what I’m really interested in is why when I iterate through my foreach, and attempt to print the employer organization name, I get a […]

How to display uploaded files in GridView and download them on clicking respective download linkbutton?

I am uploading files using fileupload, the details of the file such as file type, name of file, and complete path is getting stored in a table called exceldetails in database now i want to display the uploaded files and download them by clicking on a link button next to every file in GridView. This […]

For each category, display its subcategory

I am kind of new to SQL and asp.net and am trying to create a forum application. I have created two tables. And I am selecting the data in the tables using this query: SELECT forum_categories.CategoryName, forum_subcategories.SubCategoryName FROM forum_categories LEFT JOIN forum_subcategories ON forum_categories.CategoryId = forum_subcategories.CategoryId This is what the query returns: Now what I […]

SQL Server, connection pools vs static connection for special cases

I sort of know the answer to this, but cannot really grasp the underlying concept. I know you are always instructed to use connection pooling now. But imagine this scenario. I need to read data from one database, and one table, multiple times. Connection pooling is going to inject microseconds of overhead, but why not […]

How to assign id zero while selecting the default in dropdownlist

I have a drop Down list and I want that if the user selected nothing the id should be stored in database as 0, other wise if the user selected something then the id of that item is stored. Code is here: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Query = @”SELECT […]

Authentification works when browsed from Visual Studio but not with IIS

I have a ASP.NET website. It’s got a login page where I use built-in Membership class for user authentication. I’ve got a weird problem. In visual Studio when I point to my Default.aspx file and select View in browser I have no problem, I enter credentials and authenticate. But when I open the same website […]

how do you populate sql query result in a textbox or input control like google search dropdown result

i’m doing a small project for a friend any help would be great thank you in advance. i have a textbox however i can use a html input control as well. same idea as google bar where you able to type a letter a which will return any description match with letter a. It would […]

How can I link my SQL using a sessions to my ASP.Net(C#) web page?

I have a C# SQL query for my asp.net page which queries the database using a value stored in the session of my page (called tournyName). I have the query working, and I am using a SqlDataReader (called myReader) to read the results of the query. I cant however get the results to display on […]

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