|
-
Feb 26th, 2009, 06:36 AM
#1
Thread Starter
Addicted Member
create username and password for database dynamically
Hi,
I am using Asp.Net 2.0 application, First i have created database dynamically in my codebehind. well the db created successfully. Now i want to give username and password dynamically for my dynamically created database. Is it possible? If yes, please tell me how can we do?
Try
Dim strQuery As String
strName = txtName.Value
strQuery = "create database db" & strName & ""
createDataBase(strQuery)
Catch ex As Exception
End Try
End Sub
'Function for create database
Function createDataBase(ByVal strQuery)
Try
Dim blnResults As Boolean = False
Dim intRowsAffected As Integer
ConOpen()
Try
objCmd = New SqlCommand
objCmd.Connection = objCnn
objCmd.CommandType = CommandType.Text
objCmd.CommandText = strQuery
intRowsAffected = objCmd.ExecuteNonQuery()
If intRowsAffected > 0 Then blnResults = True
Catch ex As Exception
createDataBase = ex.Message
'MsgBox(ex.Message)
Exit Try
Finally
ConClose()
End Try
Exit_Function:
createDataBase = blnResults
Catch ex As Exception
End Try
Return Nothing
End Function
The above one is created database dynamically in code behind. I need to create username and password dynamically in code behind.
Hope yours reply.
Failing to plan is Planning to fail 
-
Feb 27th, 2009, 03:21 AM
#2
Re: create username and password for database dynamically
-
Feb 27th, 2009, 05:36 AM
#3
Thread Starter
Addicted Member
Re: create username and password for database dynamically
Hi mendhak,
I am not using windows mobile phone.I am using Asp.Net 2.0 web application.
Failing to plan is Planning to fail 
-
Feb 27th, 2009, 02:25 PM
#4
Re: create username and password for database dynamically
sp_addUser is a SQL Server function. Nothing to do with mobile phones or Compact Framework.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|