I’m very new to C#. I’m trying to retrieve the number of columns using: SELECT count(*) FROM sys.columns Could you please explain how to use the command and put it into a variable.
I have a web server and two DB servers on two different networks, Db1 and Db2(Remote Database). DB1: SQL Server 2008 R2, operating system: Windows Server 2003 SP2 DB2: SQL Server 2000, operating system: Windows Server 2003 R2 Web server: Windows Server 2003 R2 I want to insert two different records in these databases and […]
Can I get a SPID from a SqlConnection Object (SQL-Server Database) in ADO.NET? Is the SPID always the same for a connection object during its lifetime ?
What is the best approach to synchronizing a DataSet with data in a database? Here are the parameters: We can’t simply reload the data because it’s bound to a UI control which a user may have configured (it’s a tree grid that they may expand/collapse) We can’t use a changeflag (like a UpdatedTimeStamp) in the […]
I have created a prototype of a custom ORM tool using aspect oriented programming (PostSHarp) and achieving persistence ignorance (before compile-time). Now I tried to find out how much overhead does it introduce compared to using pure DataReader and ADO.NET. I made a test case – insert, read, delete data (about 1000 records) in MS […]
Hey all I’m trying to do the following insert query SqlDataSource userQuizDataSource = new SqlDataSource(); userQuizDataSource.ConnectionString = “Data Source=localhost\\SQLEXPRESS;Initial Catalog=quizApp;Integrated Security=True”; userQuizDataSource.InsertCommand = “INSERT INTO [UserQuiz] ([DateTimeComplete], [Score], [UserName]) VALUES (@DateTimeComplete, @Score, @UserName)”; userQuizDataSource.InsertParameters.Add(“DateTimeComplete”, DateTime.Now.ToString()); userQuizDataSource.InsertParameters.Add(“Score”, score.ToString()); userQuizDataSource.InsertParameters.Add(“UserName”, User.Identity.Name); int rowsAffected = userQuizDataSource.Insert(); Buti keep getting the following error: The conversion of a nvarchar data […]
i have a database driven website written in asp.net. i’d like to modify the connection string to force protocol TCP. Please advise. Thanks!
I’m wondering whether this is a bug or if I’m going something wrong. I’m loading values with a SqlDataReader from a SQL Server 2008 database but under certain circumstances, it fails to convert the SQL values into .net values. (.NET 4.0) I have traced it down to an test-case which demonstrates the actual problem: Working […]
I realize that a local SQL Server instance is not accessible to my Windows 8 app. Instead, I have a SQL Server in Azure. In SQL Server Management Studio, I just change the querystring and interact with the Azure database like any other. How can I reference that database in my Windows 8 app?
I am trying to create a database using code-first approach. When I am running the following code I am getting the following exception. How can we overcome this? Notes: I have SQL Server 2008 R2 on my system. I am not using any config file. I assumed that it will create database using conventions There […]