Hi all ,
I created a Login in sql server 2005 and set its permissions and created a user mapped to it , I have a .net app that connects to this database , How should I deploy this database with my .net app that is going to run server-based ? When using Windows Authentication Mode , to which Login should I set permissions? Should I write a script for setting these permissions?
Depends on the version of windows, IIS you use.
For XP+IIS 5.0 you should add a windows login for ASPNET account
for Win2003+IIS 6.0 you should use NETWORK SERVICE user.
You can generate a SQL Script of your database and run it with the installation package to create DB and users.
I have a problem with my SQL Server 2000, it seems that when 50 users where using my application at some point of time the cpu utilization of sqlserver goes to 100% and it comes down after some time. it happens at regular intervals.
I havnt got any response from CodeProject, but I have solved the issue myself. I tried creating Clustered And Non-Clustered Index into a table (Important table that appears in most transactions).
Also i have created some Maintenance paln that executes DBCC commands automatically.
i have a very simple problem....i have a ms access database. I have a windows form, which has two textboxes(name and depid) and a combobox(department),i want to write a query that will search all these using WHERE and LIKE.ie i need to create a function by the name search and use the query so that this will search all these...i am new to sql...expecting your help
3)database(forget about this since it is used to open and close the connections form the ms access)
i have two text and a single combobox.
basic idea is i want a query that will search even if any one of these fields are selected.
also do the same if two are selected.
also do the same if one is selected.
the code to search will have to be on my btn click for serach event(ie is in layer form1.cs).
it will have to call my query that will be in a fn: that is in datalayer ( public DataTable refinesearch(string searchstr1, string s2, string s3)
so i think i need to use "like" condition.
"select * from Employee(name of the table) where name like "string" where empid like "s2" etc........
- You haven't specified a default value for SampleField and have disallowed NULLs so the database doesn't know what value to give that field for existing rows in the table (it would normally use NULL but you've disallowed it);
- Even when you do add a default value or allow NULLs primary keys must be built on unique values, and every row in the table will then have the same value in that column;
- The SQL syntax for ALTER TABLE doesn't allow you to do both at the same time anyway;
PK_tblSample is the name I've given to the constraint, which you need if you later want to drop it. If using CREATE TABLE, you can set the primary key to a single column simply by stating PRIMARY KEY after the column definition, but the name is generated by SQL Server making it harder to use later.
You can define a primary key on a table that doesn't already have one by using the syntax above. You can create compound keys - keys consisting of multiple column values - by including all the key columns between the parentheses.
DoEvents: Generating unexpected recursion since 1991
hey how do i filter rows in a datagridview which have its datasource from a dataset?
the situation is like this:
I use c# , i got a dataset which contains a full table from my database , and i want to view on the datagridview a filtered table which result by the table.select() method, or maybe with other similar method , i couldnt manage to do that :/ i dont know how to view the viltered results only the full table , please help on the subject any help will be great , thanks in advance to all!
What I suggest is that you create a dataview based on your datatable.
Bind this dataview to your datagrid.
You can then filter, sort etc on the dataview without changing the contents or base data in your datatable.
Below is an example in VB .NET on how I have filtered and sorted using a dataview:
The first 3 columns of my report are dynamic, depending entirely on parameters passed to the stored procedure. The result set from the stored procedure is used as the dataset in my Reporting Services report. Sometimes there are fields that are not returned in the result set and I wanted to display blanks if they weren't there. I tried all the tricks using iif(isNothing(Fields!field1.Value, "",Fields!field1.Value) and using Fields(Parameters!parm1.value).Value in my argument list. Neither of these worked.
I created 3 textboxes in my report (table) and placed the three different values in them, i.e., Fields!field1.Value, Fields!field2.Value, and Fields!field3.Value. In certain cases, one or two of these fields would not be returned in the result set. I made them hidden. Then in my other textbox, where I wanted to display the value, I added as the expression, Code.DetermineFieldValue(Parameters!parm1.value, ReportItems!txtTextBox1.Value, ReportItems!txtTextBox2.Value, ReportItems!txtTextBox3.Value)
I did this for each of the 3 textboxes, just replacing parm1 with parm2 or parm3.
In the embedded code, the function was defined as:
public function DetermineField(value1 as object, value2 as object, value3 as object, value4 as object) as object
I just refered to my fields as value1 through value4 and it worked. I have been trying this for about a week and couldn't get anything to work. Apparently, it will accept the textbox not having a value, but cannot handle the dataset field directly if it is not returned. It never got to the code. Hope this helps someone.
Your post is difficult to read. To make it more understandable, you should use the <code> and <pre> tags to format your code.
You can't bind a report control to a field in your data source and then not return the field. I had the same issue a couple of years ago when developing reports that allowed the user to pick up to 3 fields to group the data on. If less than 3 grouping fields were selected, some of the grouping columns needed to be hidden. I got round this problem by writing my stored procedures to pad out the resultset with extra 'dummy' fields if less than 3 grouping fields were selected. This way, the resultset would always have the same 'shape' and my data binding expressions would always work. In the report, I would then hide the grouping columns that were not required.
Is there a way to make a database connection more dynamic, so that the database could be moved to a different directory and still function without requiring the need to change the path in the database code itself? The code I have so far is static and requires changing each time the MS Access file moves or is moved to a different directory.
Dim strDBPath As String
strDBPath = "J:\GELCO DATABASE\Headcount Database\Headcount Database.mdb"
Set dbsHeadcount = OpenDatabase(strDBPath)