SQL Server 2005 express connectivity with Visual Studio.NET 2005

Hello

I'm having a problem with the server connection and my C# code. The code executes alright but no data is entered into the database behind it.  I'm pasting the connection code over here as well. The sql commands are used in the code. I think I used the sql server mobile edition which is installed along with visual studio.net 2005. Anyone know what's wrong, and can help me out? Thanks in advance.

public static void storeInDb(string trackName, string artist, string albumTitle, string year, string path, uint[] fp)

{

string connStr="Data Source=.\\SQLEXPRESS;AttachDbFilename='"+path+"\\Data\\ACI.mdf';Integrated Security=True;User Instance=True";

SqlConnection conn = new SqlConnection(connStr);

conn.Open();

string sql = "INSERT INTO Clip(Song, Artist, Album, Year) VALUES('" + trackName;sql = sql + "','" + artist + "','" + albumTitle + "','" + year + "')";

 

SqlCommand cmd = new SqlCommand(sql, conn);

cmd.ExecuteNonQuery();

 

sql=
"SELECT max(ClipID) FROM Clip";

cmd = new SqlCommand(sql, conn);

int id = Int32.Parse(cmd.ExecuteScalar().ToString());for (int i = 0; i < fp.Length; i++)

{

sql="INSERT INTO Hash VALUES ("+id+","+(i+1)+","+(int)fp[i]+")";

cmd = new SqlCommand(sql, conn);

cmd.ExecuteNonQuery();

}

conn.Close();

}

0
ChaoticMayhem
12/5/2007 5:07:50 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
895 Views

Similar Articles

[PageSpeed] 19

Hi,

The code executes alright but no data is entered into the database behind it

Since we don’t know the actual data table schema and corresponding fields in your database, maybe we can’t find the exact cause of the problem. But we can provide you some general ways to solve the problem.

Just add a breakpoint in your codes, especially to check the insert statement which actual works in your code, and then, put the insert statement in some tools like Query Analyzer and run it, to see if it can work.

In this way, I think you can find the issue which cause the problem.

Thanks.


Michael Jin.
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Nai
12/10/2007 3:34:13 AM
Reply:

Similar Artilces:

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

Visual Basic .NET 2005 Express & Sql Server 2005 Express remote server
Hi,  I want to make a component library in Visual Basic.NET and connect to a remote Sql Server. When I create a new DataSet with the wizard, I can only connect to a .mdf file, but not to a Sql Server. With Visual Web Developer I can connect to a Sql server. What is the difference between these enviroments ? How can I do the same with Visual Basic.NET ?  Thanks in advance. Visual Basic .NET Express cannot connect to SQL Servers. The Visual Web Developer is the only express edition that can utilize SQL Server. You need to upgrade to Visual Studio 2005 Standard or higher.Cheers,&n...

I cannot stop Visual Studio.NET 2005 from looking for SQL Server 2005 instead of SQL 2000
I would like to know how to set SQL2000 as the default database server when running any webapplication. I have installed Visual Studio.NET and SQL Server 2000 locally in my laptop.  But anytime I want to run a webapplication I am getting the following error:System.Data.SqlClient.SqlException was unhandled by user code  Class=20  ErrorCode=-2146232060  LineNumber=0  Message="An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server doe...

Installing .NET Framework, Sql Server 2005 Express, and Visual Studio 2005 Professional
Will someone please offer some advice, a walkthrough, or something to help me through this?  I installed all three of these pieces (.NET, SQL Server 2005 Express, and VS 2005 Professional) onto a WinXP box.  I was unable to get it to work.  It kept throwing SQL errors when I tried to run the security setup for the Personal Website Starter Kit.  So, I uninstalled everything except .NET and reinstalled.  At this point I was able to get to the setup, but unable to add users.  It doesn't throw errors or anything, it just doesn't do anything.  I really re...

Visual Studio 2005 Standard with SQL Express and SQL Server 2005 Developer Edition
Hi folks,I had visual studio 2005 Standard edition (with SQL Express) running. Then I install SQL Server 2005 Developer edition.It generally worked however some part of SQL Server Developer did not work properly (namely diagrams). I browsed the internet and found something that said I should install the .NET Framework Service Pack 1. I did so. It fixed SQL Server 2005 Developer Edition however it seems to have broken portions of Visual Studio. Specifically, typed dataset. I could add a dataset however I could no longer configure or add a table adapter. Telling me the "data provider may ...

Sql Server 2005 Reporting Service + Visual Studio.NET 2005
Hi, Iam new 2 sql server 2005 reporting services, I created a report server project with few reports and deployed in reportserver. Everything is working fine but i want to integrate these reports to my VS.net 2005 web appliction. Through the interface i have to pass the perameters to my reports. Iam looking for help thxs in advance PradeepPradeep Reddy Take a look over here for a working example : http://www.codeproject.com/aspnet/ReportViewer.asp   HTH,Suprotim Agarwal -----http://www.dotnetcurry.com-----ASP.NET Grid With Excel Capabilities | 27 GridView Tips & Tricks |...

AxCMS.net Award 2005 | 1st place: MSDN Professional subscription including Visual Studio 2005 and SQL Server 2005; 2nd place: new Xbox 360
We would like to introduce the 100% cost free AxCMS.net 5.2.2 - brand new release! AxCMS.net is a 100% cost free Enterprise CMS platform for architects and professional developers based 100% on Microsoft .NET. With the new download version we offer ... Improved user interface (thank you for feedback!) International support avaliable! New features (muitisite, permissions, authentication, newsletter, ...) Focused on software architects and professional developers Introducing AxCMS.net Award 2005! The AxCMS.net Award 2005 represent an opportunity ...

How to connect SQL Server 2000 in visual studio.net 2005
How can i connect my ASP.NET web application with my sql server 2000. i used visual studio 2003, and there we drag and drop the data adapter and  then a sql connection and then use them in our application. but here we have only sqldatasource or something. so please tell me to make the connection and data retrieval procedure. Kumud Tripathi You can drag a SQL Data Source object onto you web form and select configure data source. This will give you a wizard to connect to a database, and also allows you to set up insert, delete, update statements. You can then use this datasource to...

Visual Studio 2005 Express and SQL server 2005 Express
Just a question from a Microsoft Freak. Wil dotnetnuke in the nearby future support SQL 2005 Express and wil there come a "template" for modules for Visual Studio 2005 Express ? I guess that depends on what you understand by "nearby future". I think SQL 2005 Express will work with the current version already (haven't tried however) and with such a big community I think maybe someone will eventually create a template ? Geert Veenstra Well, let me be the test case. I'l try it this evening and come back to you an the answer about SQL 2005 express. About the visual...

Is Visual Studio.Net 2003 Compatible with SQL Server 2005 Express?
Hi, I am new to this. I have Visual Studio 2003 Developers Edition, but I do not have SQL server 2000, so I downloaded SQL Server 2005 Express(which is free). My question is, is Visual Studio.Net 2003 Compatible with SQL Server 2005 Express? That is, do I need 2.0 framework to work with SQL server 2005, or version 1.1 framework will work fine? Thank you As far as calling the db, it should be fine. You just dont have the integrated functionality (managed SPROCs, etc) that you would get with VS2005(but even then you need the big versions)....

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi (and HELP!),   I downloaded the Personal WebSite Starter Kit and got it working no problem on my local machine.  But I've had nothing but frustration trying to get it up and running on a webhosting site.  I picked hostmysite.com which uses SQL Server 2005.  I was under the impression that it wouldn't be that big a deal to convert the .MDF files that Sql Server Express uses to a SQL Server 2005 database.  I tried using SQL Server Management Studio Express.  I was able to "see" my remote database on hostmysite.com, but I was not able to import the .mdf file...

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi,Basically i built a webpage with Login and it's working well from my local machine.Right now, i'm using Database Publishing Wizard. the problem is how do i convert.MDF files to .SQL 2005 to get my database publish in the internet? thanks  Place your .MDF file in the App_Data directory, change the connection string accordingly and then publish your web site. ----------------------------------------------------------Please click Mark As Answer if this helped in solving your problem.  Please click "Mark As Answer" if this hepled in solving your problem. ...

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi (and HELP!),   I downloaded the Personal WebSite Starter Kit and got it working no problem on my local machine.  But I've had nothing but frustration trying to get it up and running on a webhosting site.  I picked hostmysite.com which uses SQL Server 2005.  I was under the impression that it wouldn't be that big a deal to convert the .MDF files that Sql Server Express uses to a SQL Server 2005 database.  I tried using SQL Server Management Studio Express.  I was able to "see" my remote database on hostmysite.com, but I was not able to import the .mdf files ...

SQL Server 2005
I'm very confused.  I installed Visual Studio 2005 and thought I understood that SQL Server 2005 came with it, but it appears that it's SQL Server 2005 - Express.  Can anyone tell me what I need to do in order to get Data Transformation Services loaded or the equivalent of DTS in SQL Express?     beejay I have to say: actually SQL Express, not SQL2005 full version, comes with VS2005. To manage your SQL Express databases much easier, you can download a Management Studio Express from here: http://msdn.microsoft.com/vstudio/express/sql/download/ Then you can...

Web resources about - SQL Server 2005 express connectivity with Visual Studio.NET 2005 - asp.net.sql-datasource

TE Connectivity - Wikipedia, the free encyclopedia
TE Connectivity Ltd. designs and manufactures connectivity and sensor solutions for a variety of industries including automotive, industrial ...

Mark Zuckerberg Goes Into Detail On Facebook Connectivity Lab, Internet.org
Perhaps Facebook Co-Founder and CEO Mark Zuckerberg is just a wee bit excited about the Connectivity Lab , the initiative aimed at using high-altitude ...

The power of connectivity
By Keven McCammon, site data center manager, Facebook Forest City Data Center Today we announced that we’re partnering with the Town of Forest ...

Facebook, Internet.org launch Connectivity Lab
... CEO Mark Zuckerberg shed some light on the company’s acquisition of drone-maker Titan Aerospace, announcing the launch of Facebook’s Connectivity ...

Samsung Galaxy S3: Connectivity demo - USB OTG, MHL, bluetooth keyboards/mice, games controllers - YouTube ...
AndroidNZ.net - the best source for Galaxy S3 content! For navigation in the video use these links: USB Pendrive @0:55, 500GB portable drive ...

Mid-2012 MacBook Airs offer improved performance and connectivity
Believe it or not, it's been nearly four and a half years since Apple released the original MacBook Air. At the time, it was revolutionary in ...

Connectivity is key in society
They’re billing it as the place where Lewisham meets Summer Hill meets the city – and with good reason.

BMW to launch new connectivity service
Soon your car will notify the dealer when it’s due for a service. BMW Australia will introduce a new suite of in-car connectivity apps in its ...

The key to a successful hybrid cloud infrastructure? Flexible connectivity
It's becoming increasingly clear that - for most organisations - taking a 'hybrid' approach to cloud adoption makes sound business sense.

Facebook Connectivity Lab promotes access to Internet in remote areas - CTV News
Facebook is giving more details about its effort to connect remote parts of the world to the Internet - and it involves drones, lasers and satellites. ...

Resources last updated: 12/8/2015 10:23:41 AM