i writed a query like this: SELECT [FirstName], [LastName] FROM [WorkersView] WHERE ([FirstName] LIKE ‘%’ + N’علی’ + ‘%’ ) AND ([LastName] LIKE ‘%’ + N’مسروری’ + ‘%’) and it’s work very well! and …
Tag: asp.net
NVarChar to C# Data Types
The database stores nvarchar, I retrieve the information and I’d like to jam it into C# data types without any declarative conversion code. Can you implicitly convert nvarchar to C# data types? (e.g. nvarchar to int) Answer Nvarchar is a string, if you want to turn it in to a int you will have to go through some kind of
Stuck on SqlDataReader.GetValues Method
I am making a call to a SQL stored procedure which is returning a small table of users and their bosses. What I would like to do is compare this information against a variable in a different part of …
DropDownList has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
I keep getting the above error in the title line and it makes no sense, because I am using a sample table with only 5 records and each record has a value as per the drop down menu. This is my code used to declare the drop down list. I have joined two tables in my SQL data source to
Membership stored procedure aspnet_Membership_CreateUser not working
I have been trying to make the build in stored procedure to work with Register.aspx. I’m not using the wizard part. Hence writing my own code. I don’t understand where the error is. If I use exec stored procedure and send the same value it will execute in Management Studio. But in code it fails. Here is the code that
Sql Command Not Working
I wrote the following code, but nothing is being inserted into the database. I tried changing the SA password in the connection string to something incorrect and the code isn’t catching the exception. What am I doing wrong? Answer As stated by the OP in the comments. Once the try-catch was resolved it was discovered that it just a mismatched
Insert datetime from C# into SQL Server database
when I try to insert datetime value into a SQL Server database I get this error: Conversion failed when converting date and/or time from character string Code: Table table has 1 datetime column called time. Edit: my table created in msSQL 2012: http://i.imgur.com/TJ3t3y7.png my real code is: Answer The actual problem here is that you’re writing the parameter inside quotes:
Calling Functions in SqlCommand
Can I use Sql Server functions in myCommand.CommandText and why? Answer If you mean, SQL Server user defined functions. Then, yes; you can use it normally like: The reason it works is because this is the way that functions are called in SQL Server directly.
how can i set the parameters for the sql query optional?
I build a Web Service in ASP.Net which sends me a list of rooms. The parameters are id’s which are separated by a comma. I saved them to a string and build a sql select query. When I send all 4 parameters I everything works fine and I get a result. But when I send less then 4 I get
Change default date format of the asp sql database ( the one storing the values)
I have a gridview and SqlDatasource. I have a column called Date VMS which is type Date. I’ve noticed that the format for adding a date won’t allow adding a date like: 30/02/2012. ( DD/MM/YYYY) I have an Excel sheet from which I’m copying the rows and I’m adding them in the table. The format of the date in the