Showing posts with label become. Show all posts
Showing posts with label become. Show all posts

Sunday, March 11, 2012

Cannot view databases in view list for SQL 2005

I have created a couple of new logons/ users and they are dbo's of a few
databases. However it has become apparent that for some reason the databases
are not "browseable" through the SSMS dropdown. Even running sp_databases
does not return their names. The databases can be accessed through text
(e.g. USE dbname) and do look like full access is available.
What on earth is going on? The only difference between this and another
(working) box is that this non-working one is 64 bit windows with 64bit SQL
(x64) wheras the other is 32 bit on 32 bit. I know this because they both
use automated builds which I created.
Regards,
Mark
Hi Mark
"Mark Broadbent" wrote:

> I have created a couple of new logons/ users and they are dbo's of a few
> databases. However it has become apparent that for some reason the databases
> are not "browseable" through the SSMS dropdown. Even running sp_databases
> does not return their names. The databases can be accessed through text
> (e.g. USE dbname) and do look like full access is available.
> What on earth is going on? The only difference between this and another
> (working) box is that this non-working one is 64 bit windows with 64bit SQL
> (x64) wheras the other is 32 bit on 32 bit. I know this because they both
> use automated builds which I created.
> Regards,
> Mark
I assume by dropdown you mean the Object Browser (F8).
Have you changed the permissions for these users at all since they created
the databases?
From BOL:
sp_databases requires CREATE DATABASE, or ALTER ANY DATABASE, or VIEW ANY
DEFINITION permission, and must have access permission to the database.
Cannot be denied VIEW ANY DEFINITION permission.
John

Cannot view databases in view list for SQL 2005

I have created a couple of new logons/ users and they are dbo's of a few
databases. However it has become apparent that for some reason the databases
are not "browseable" through the SSMS dropdown. Even running sp_databases
does not return their names. The databases can be accessed through text
(e.g. USE dbname) and do look like full access is available.
What on earth is going on? The only difference between this and another
(working) box is that this non-working one is 64 bit windows with 64bit SQL
(x64) wheras the other is 32 bit on 32 bit. I know this because they both
use automated builds which I created.
Regards,
MarkHi Mark
"Mark Broadbent" wrote:

> I have created a couple of new logons/ users and they are dbo's of a few
> databases. However it has become apparent that for some reason the databas
es
> are not "browseable" through the SSMS dropdown. Even running sp_databases
> does not return their names. The databases can be accessed through text
> (e.g. USE dbname) and do look like full access is available.
> What on earth is going on? The only difference between this and another
> (working) box is that this non-working one is 64 bit windows with 64bit SQ
L
> (x64) wheras the other is 32 bit on 32 bit. I know this because they both
> use automated builds which I created.
> Regards,
> Mark
I assume by dropdown you mean the Object Browser (F8).
Have you changed the permissions for these users at all since they created
the databases?
From BOL:
sp_databases requires CREATE DATABASE, or ALTER ANY DATABASE, or VIEW ANY
DEFINITION permission, and must have access permission to the database.
Cannot be denied VIEW ANY DEFINITION permission.
John

Cannot view databases in view list for SQL 2005

I have created a couple of new logons/ users and they are dbo's of a few
databases. However it has become apparent that for some reason the databases
are not "browseable" through the SSMS dropdown. Even running sp_databases
does not return their names. The databases can be accessed through text
(e.g. USE dbname) and do look like full access is available.
What on earth is going on? The only difference between this and another
(working) box is that this non-working one is 64 bit windows with 64bit SQL
(x64) wheras the other is 32 bit on 32 bit. I know this because they both
use automated builds which I created.
Regards,
MarkHi Mark
"Mark Broadbent" wrote:
> I have created a couple of new logons/ users and they are dbo's of a few
> databases. However it has become apparent that for some reason the databases
> are not "browseable" through the SSMS dropdown. Even running sp_databases
> does not return their names. The databases can be accessed through text
> (e.g. USE dbname) and do look like full access is available.
> What on earth is going on? The only difference between this and another
> (working) box is that this non-working one is 64 bit windows with 64bit SQL
> (x64) wheras the other is 32 bit on 32 bit. I know this because they both
> use automated builds which I created.
> Regards,
> Mark
I assume by dropdown you mean the Object Browser (F8).
Have you changed the permissions for these users at all since they created
the databases?
From BOL:
sp_databases requires CREATE DATABASE, or ALTER ANY DATABASE, or VIEW ANY
DEFINITION permission, and must have access permission to the database.
Cannot be denied VIEW ANY DEFINITION permission.
John

Thursday, March 8, 2012

Cannot upload file to database

Can anyone correct my code?
I will like to add a url to my database and upload my image to web server.
txtAddTitle will become my title name
txtFileName allow user to type in image name that will upload to webserver and at the meantime will insert into database as url references
value for @.chapterid will get from drop down list(ddlLesson) and the index value will store in database.

now i am able to upload my images with the file name that i have given to web server, but I am unable to insert data to my database.

Sub DoUpload(ByVal Sender As Object, ByVal e As System.EventArgs)
Dim sPath As String
Dim sFile As String
Dim sFullPath As String
Dim sSplit() As String
Dim sPathFriendly As String


'Upload to same path as script. Internet Anonymous User must have write permissions
sPath = Server.MapPath("../Tutorial")
'sPath = Server.MapPath(".")
If Right(sPath, 1) <> "\" Then
sPathFriendly = sPath 'Friendly path name for display
sPath = sPath & "\"
Else
sPathFriendly = Left(sPath, Len(sPath) - 1)
End If


'Save as same file name being posted
'The code below resolves the file name
'(removes path info)
sFile = txtFileName.Text
'sFile = txtUpload.PostedFile.FileName
sSplit = Split(sFile, "\")
sFile = sSplit(UBound(sSplit))


sFullPath = sPath & sFile
Try
txtUpload.PostedFile.SaveAs(sFullPath)
lblResults.Text = "<br>Upload of File " & sFile & " to " & sPathFriendly & " succeeded"

Catch Ex As Exception

lblResults.Text = "<br>Upload of File " & sFile & " to " & sPathFriendly & " failed for the following reason: " & Ex.Message
Finally
lblResults.Font.Bold = True
lblResults.Visible = True
End Try

Dim mycommand As SqlCommand
Dim myConnection As SqlConnection
Message.InnerHtml = ""
'to all the valur to database
If IsValid Then

myConnection = New SqlConnection("Server=localhost;UID=sa;pwd=;database=u")
mycommand = New SqlCommand("INSERT INTO t_linkTitle(link_chapterid,link_name,link_url) VALUES (@.chapterid,@.titleName,@.titleUrl)", myConnection)

mycommand.Parameters.Add("@.chapterid", SqlDbType.VarChar, 50).Value = ddlLesson.SelectedItem.Value
mycommand.Parameters.Add("@.titleName", SqlDbType.VarChar, 50).Value = txtAddTitle.Text
mycommand.Parameters.Add("@.titleUrl", SqlDbType.VarChar, 100).Value = txtFileName.Text

mycommand.Connection.Open()
msgErrorTitle.Style("color") = "OrangeRed"
Try
mycommand.ExecuteNonQuery()
msgErrorTitle.InnerHtml = "New title <b>" + txtAddTitle.Text + "</b> Added to " + "<b>" + ddlLesson.SelectedItem.Text + "</b><br>" + mycommand.ToString()
Catch Exp As SqlException

If Exp.Number = 2627 Then
msgErrorTitle.InnerHtml = "ERROR: Title already exists. Please use another title"
Else
msgErrorTitle.InnerHtml = "ERROR: Could not add record, please ensure the fields are correctly filled out"
End If

End Try

mycommand.Connection.Close()
End If

LoadTitle()

End Sub

So what sql server error number are you getting when you attempt an insert?|||

emulti wrote:

So what sql server error number are you getting when you attempt an insert?

It show this"ERROR: Could not add record, please ensure the fields are correctly filled out"