Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Wednesday, March 28, 2012

MS SQL SERVER version

i have a project that suggests to use MS SQL SERVER 2000. i have VISUAL STUDIO 2005. can i use the MS SQL SERVER in it anyway? are there differences that will occur?it will work fine. :)

is your project in managed code? if so take a look at the classes in System.Data.SqlClient for talking to sql server:

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.aspx|||can u give me an example of a connection string. i had one but it's not working and i don't know if the version is the problem. im using visual studio 2005 and i created a database inside it with ms sql server of course. that's all!|||http://www.connectionstrings.comsql

Monday, March 26, 2012

MS SQL Server Express connection error from VB.net Program

I am trying to make new connection with SQL Server 2005 Express Database fro
m
my Visual Basic.Net program. I am using connection string as "Dim
connectionString As String = "Data Source=.\SQLEXPRESS;Initial
Catalog=MgmtSystem;User Instance=True".
But it is giving me error as " Failed to generate a user instance of SQL
Server. Only integrated connection can generate a User Instance".
I can connect to this "MgmtSystem" database successfully using Microsoft SQL
Server Management Studio Express though.
What could be the possible reason for this error? How do I get the correct
connection string? and what does integrated connection mean? Your help will
be appreciated.
My application is in Access at the moment, but I am planning to migrate it
to Microsoft SQL Server Express 2005. I am completely new to Microsoft SQL
Server Express 2005 Express version.Fixed it by myself. I changed the connectiuon string to "Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\MgmtSystem.mdf;Initial Catalog=MgmtSystem;Persist
Security Info=True;" ..and it worked..
"Sujata P" wrote:

> I am trying to make new connection with SQL Server 2005 Express Database f
rom
> my Visual Basic.Net program. I am using connection string as "Dim
> connectionString As String = "Data Source=.\SQLEXPRESS;Initial
> Catalog=MgmtSystem;User Instance=True".
> But it is giving me error as " Failed to generate a user instance of SQL
> Server. Only integrated connection can generate a User Instance".
> I can connect to this "MgmtSystem" database successfully using Microsoft S
QL
> Server Management Studio Express though.
> What could be the possible reason for this error? How do I get the correct
> connection string? and what does integrated connection mean? Your help wil
l
> be appreciated.
> My application is in Access at the moment, but I am planning to migrate i
t
> to Microsoft SQL Server Express 2005. I am completely new to Microsoft SQL
> Server Express 2005 Express version.|||Fixed it by myself. I changed the connectiuon string to "Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\MgmtSystem.mdf;Initial Catalog=MgmtSystem;Persist
Security Info=True;" ..and it worked..
"Sujata P" wrote:

> I am trying to make new connection with SQL Server 2005 Express Database f
rom
> my Visual Basic.Net program. I am using connection string as "Dim
> connectionString As String = "Data Source=.\SQLEXPRESS;Initial
> Catalog=MgmtSystem;User Instance=True".
> But it is giving me error as " Failed to generate a user instance of SQL
> Server. Only integrated connection can generate a User Instance".
> I can connect to this "MgmtSystem" database successfully using Microsoft S
QL
> Server Management Studio Express though.
> What could be the possible reason for this error? How do I get the correct
> connection string? and what does integrated connection mean? Your help wil
l
> be appreciated.
> My application is in Access at the moment, but I am planning to migrate i
t
> to Microsoft SQL Server Express 2005. I am completely new to Microsoft SQL
> Server Express 2005 Express version.

Wednesday, March 21, 2012

MS SQL SERVER 2000 INSTALLATION

Hi,
I'm learning ASP.net and I just bought Visual Studio .net professional. I tried to install MS SQL server 2000 on my two computers. One OS is windows server 2003 standard edition and another is Win XP professional.

Both of them appeared SQL Server Upgrade Wizard "from server 6.5 upgrade to server 2000". I don't think I have server 6.5 installed and there is no server 6.5 application interface to run the server. What's the problem? I cannot run the Wizard successfully. Can I just ignore it?
Thank you,
William

Yes ignore it because there is no upgrade from SQL Server 6.5 to 2000, maybe you answered questions Windows asked you about SQL Server please don't answer them. Windows doesnot know any application installed in it, you know SQL Server so ignore any question that is not relevant to you and answer only when you are forced. Hope this helps.|||Thank you for your reply.
It comes another question.
I'm learning Accessing and Binding Data. It's a sample from chapter 9 of the book "MICROSOFT ASP.NET PROGRAMMING WITH MICROSOFT VISUAL BASIC .NET"
I got the error message as followings. I think it is the problem from set up the ASPNET account. I used SQL Enterprise Manager to set up. It looks fine. I feel not. But I don't know how to check it.
And then I tried to open a command prompt and typed in
oSql -S(local)\VSdotNET DE
And Icannot get a 1> prompt.
I got the message:
usage: osql [-U login id] [-P password]
[-S server] ..


Can you let me know where the problem is?

Thank you very much!

Server Error in '/ASPNETSBS/Chapter_09' Application.

Login failed for user 'WILLIAM\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: Login failed for user 'WILLIAM\ASPNET'.
Source Error:
Line 31: Line 32: Dim MySqlConn As New SqlConnection(ConnStr)Line 33: MySqlConn.Open()Line 34: TryLine 35: Dim SQL As String

Source File:C:\Microsoft Press\ASPNETSBS\Chapter_09\ExecuteXmlReader.aspx.vb Line:33
Stack Trace:
[SqlException: Login failed for user 'WILLIAM\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 Chapter_09.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Microsoft Press\ASPNETSBS\Chapter_09\ExecuteXmlReader.aspx.vb:33 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750


Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032|||First there are two permissions in SQL Server you may have created the database permissions now go to the security section in Enterprise Manager and create the server permissions. Second you connect through the Datalink property at the top of Visual studio not through osql. Try the link below for data bind.
Hope this helps.
http://www.gotdotnet.com/team/vsrapideval/|||Thank you Caddre,
I got some information fromhttp://weblogs.asp.net/coltk/archive/2003/07/10/9920.aspx
So I fixed the problem by following the codes. I'm so happy to make a progress. All of you make the forum great.
William|||I am glad it helped and thanks for the link I know I will need it in the future. Thanks again.

Monday, March 12, 2012

ms sql image + vb.net

Hi,

could anyone help me how to get the images from ms sql database with asp.net (visual basic)?

I have a field in the database with datatype image, and there are a couple of images in this table.

Now I am wondering how to get this images and view them on my .aspx page?

Thank you.I've have solved it.

<%@. Page Language="vb" debug="true" %>
<%@. Import Namespace="System.Data" %>
<%@. Import Namespace="System.Data.SqlClient" %>
<script runat="server">

Dim u As String

Sub Page_load
u = Request.QueryString("u")
getImage(u)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<script runat=server
Public Sub getImage(ByVal u)

' Create Instance of Connection and Command Object

Dim myConnection As New SqlConnection("Server=localhost;uid=xx;pwd=xx;database=xx")

Dim myCommand As New SqlCommand("Select avatarImage from yaf_user where Name = @.u", myConnection)
myCommand.Parameters.AddWithValue("@.u", u)

Try

myConnection.Open()

Dim myDataReader As SqlDataReader

myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

Do While (myDataReader.Read())

'Response.ContentType = myDataReader.Item("avatar")
Response.ContentType = "image/gif"
Response.BinaryWrite(myDataReader.Item("avatarImage"))

Loop

myConnection.Close()

Response.Write("Person info successfully retrieved!")

Catch SQLexc As SqlException

Response.Write("Read Failed : " & SQLexc.ToString())

End Try

End Sub

</script>
</body>
</html

Friday, March 9, 2012

MS SQL database not connecting problem

hi

I usually did my database in SQL Server Management Studio Express then when I was in Visual Studios I would connect to it in the server explorer tab but I wanted to try to do it through Visual studios so I took my database files then went to my app_data folder and added them as existing items. I then went back to the server explorer tab and set it up.

Everything thing seemed to set up but when I run it I get an error.

I get this error when it does conn.Open();

Error:

1System.Data.SqlClient.SqlException was unhandledbyuser code2 Message="Cannotopen database \"Japanese\" requestedby the login. The login failed.\r\nLogin failedforuser'HOWSER\\chobo'."3 Source=".Net SqlClient Data Provider"4 ErrorCode=-21462320605 Class=116 LineNumber=655367 Number=40608Procedure=""9 Server="localhost\\SqlExpress"10 State=111 StackTrace:12 at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)13 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)14 at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)15 at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)16 at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)17 at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)18 at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)19 at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentityidentity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)20 at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)21 at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)22 at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)23 at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)24 at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)25 at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)26 at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)27 at System.Data.SqlClient.SqlConnection.Open()28 at Practice.Page_Load(Object sender, EventArgs e)in h:\Website\Japanese\Practice.aspx.cs:line 2829 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)30 at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)31 at System.Web.UI.Control.OnLoad(EventArgs e)32 at System.Web.UI.Control.LoadRecursive()33 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)34
This is what I have as my connection stuff
webconfig
1 <connectionStrings>2 <add name="Japanese" connectionString="Server=localhost\SqlExpress;3 Database=Japanese; Integrated Security=True"4 providerName ="System.Data.SqlClient"/>5 </connectionStrings>67
In my file
 
1 SqlConnection conn;2 SqlCommand comm;3 SqlDataReader reader;45string connectionString = ConfigurationManager.ConnectionStrings["Japanese"].ConnectionString;6 conn =new SqlConnection(connectionString);78 comm =new SqlCommand("SELECT HiraganaCharacter,HiraganaImage FROM Hiragana", conn);9 conn.Open();10 reader = comm.ExecuteReader();
Thanks

 

Hi,

can you check your code connection string?

it would be usually in this format for SQLserver connection in the config file:

connectionString="Data Source=yourservername;Initial Catalog=yourdatabasename;User ID=userid"

providerName="System.Data.SqlClient"

Hope this helps

Monday, February 20, 2012

MS SQL 05 auto increment

Hello,

Firstly Hello to everyone I'm new the forum and fairly new to .net

I'm working on web datbase application using visual studios 05 and MS SQL05 I've used 2003 (briefly) before but 2005 is very new to me.

To my problem I download the GUI interface from microsoft so I can now setup a local database and do my own testing.

I have created the table and fields with in it however on a particular table i have made a primary Key and left it as an INT but I would like to set it as auto increment ! I dont know how to select that option as i was used to mysql way of doing things or does this have to be done as a stored procedure ?

Any assistance much appreciated.

in the management studio you can right click on the table name and click on "modify table" then in the right pane select the column you want to set autoidenty on to and in the bottom pane check the Identity property.

MS SQL & Visual Studio 2005

I want to install SQL on the same machine as VS 2005 Pro for development.
While trying to install the version of SQL that comes with the VS 2005 Pro
I'm getting error messages and the SQL engine will not start. Is it
possible to have the SQL install on the same machine as the VS 2005 or do I
need to install the personnel edition instead? What should I do?

Charles MacLean
MTS, Inc.Charles MacLean (charlesmaclean@.sbcglobal.net) writes:

Quote:

Originally Posted by

I want to install SQL on the same machine as VS 2005 Pro for
development. While trying to install the version of SQL that comes with
the VS 2005 Pro I'm getting error messages and the SQL engine will not
start. Is it possible to have the SQL install on the same machine as
the VS 2005 or do I need to install the personnel edition instead?


That should be possible.

Quote:

Originally Posted by

What should I do?


You could always post the error messages you get...

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx