Showing posts with label controls. Show all posts
Showing posts with label controls. Show all posts

Friday, March 9, 2012

help needed ! sql query

my app contains one form (aspx) and it has different controls to be filled by user (textbox,radiobutton ..etc)
it has one button which i want to use to pass values entered in these controls to other page and do some queries to sql server there (2nd page)
Now the thing is ...my controls can have NULL values ...like user could enter just one parameter and hit button
or user can fill 2 parameter and hit enter
so on the other hand (2nd page) how should i query the database accordingly ...

Example:
if (myTextBox.Text == String.Empty)
{
myParameter.Value = DBNull.Value;
}
else
{
myParameter.Value = myTextBox.Text;
}
|||

You can always use an If Else loop to write the query.
If IsDbNull(parameter) Then
parameter = (Whatever default value or just null)
Else
parameter = Request.Form("name of parameter")
End If
I hope this is clear enough.

Friday, February 24, 2012

help me understand how to move the express database to live

im using the the login controls with asp.net

when i test locally everything works great, its see the ASPNETDB.MDF file, checks the login info and passes the user on to the next page.

However when i move the application to the live server it fails, it cant find the datasource that contains users/password etc. here is there error:

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 does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

So im missing something here, im used to connecting directly to a remote SQL database and accessing the info from there.

Can someone point me in the right direction? Can the MDF file not be used off the server itself without SQL express installed? Do i need to migrate those tables into a real SQL database?

Thanks,
Sean

update:

installed SQL express on the webserver and it seems to work better now.

I dont get the same error however the user can not login, each time i get "invalid login etc".

If i use the local debug mode it will login correctly.

:(

Any ideas where i need to look?|||

still no luck with this.

can anyone help me understand the process of moving a sql express DB to a production enviroment with SQL Server 2000?