Showing posts with label named. Show all posts
Showing posts with label named. Show all posts

Monday, March 19, 2012

how can i make checkbox

hello all i have a 2 questions hope that u can help me my first question is: in ms access there was a data type named yes/no and it was a checkbox is there a checkbox data type in sql server 2005?

my second question is i need the connection code between asp.net 2005 and sql server 2005 i searched in here for that code but i got more confuse i found two codes and both are not working so hope u can give me the right connecting code. that's all thanks

Thebitdata Type is the equivelent to ths Yes/No data type.

If you mean the connection string, it is like this for SQL Server 2005:

server=<ServerAddress>;uid=<userId>;password=<password>;database=<databaseName>

Of course, fill in the bold to the actual values. Also, heres a good website if you ever need any connection strings:

http://www.connectionstrings.com/

|||

hellojavanthanks for ur reply i tried the bit data type but no checkbox appeared and i tried to write yes but it didnt accept that value so plase hope u tell me what i shoud do? and as for the connection string i dont mean that string but i mean the main connection string for example in vs2003 when i want to connect to a database that's what i should do:

Dim conn as newsqlconnection (the string u wrote is here)

the bold statment that what i want to know? thanks for ur reply again

|||no one can help?!!!!!|||

Datatypes are not restricted to a specific UI control that can display it like in Access. Some applications that use a grid-like or form-like interface to allow you to enter values into a table will display a checkbox for a column that is defined as bit (or bit not nullable), while some others will display it as it's raw value of 0 or 1. Depends on the tool.

In ASP.NET, you have the option of displaying it to the end user any way you want. I believe the form wizards by default will make a checkbox out of it, and some datagrids will as well, I am unsure of what the built in datagrid will do, I'd guess mostly a textbox with 0 or 1 in it. The gridview might be more intelligent than that, but I wouldn't bet on it either.

The bit datatype is the closest match, but you could also make a column of char(1) and store "Y"/"N" in it and use a checkbox to display it to the end user, but I know of no tools that will automatically turn that into a checkbox for you. You could also make it a varchar(3) and store "yes"/"no" in it as well, and optionally put a check constraint to make sure only the values "yes"/"no" or "Y"/"N" are able to be stored in there.

|||helloMotleythanks for ur reply and as u said there as an option in the gridview allow me to delete and select and edit in the properties box but i have another problem when i get to delete a record i have an error said that deleting is not supported by data source i serched for that error and i knew that the solution is when i configuring my data source in the data source wizard i have to click on advanced sql generation option that let me check two choices to enable insert and deleting and update the problem is that two choices are not active i dont know why so please if u can help me then i'm waiting thanks for u all.|||Sorry, I was away in Florida and couldn't check my emails. The bit data type is actually a 0 or 1 value. It is the closest thing you can get to Yes/No in Sql Server. You have to check the value of your checkbox and insert the proper data type based on that. I wouldnt recommend doing a char(1) because that is not a true yes/no type field.|||hello again javan thanks for ur care about reply but i have a little problem as i said in my last post that advanced option button is not active so i hope u can really help cos i really need that option thanks for u all.|||Yes,... I found this problem in the SQL DataSource too before. It seems that once the datasource is created then the option is not available when you go to edit it. What you have to do is delete and then recreate the datasource and make sure you press the advanced options on the first try. The check the "Generate Insert/Edit/Delete" checkbox.|||hello JAVAN thanks for ur reply i did as u said but no use problem still exist anyway i sent u private msg hope u reply it thanks again.|||

The "Generate Insert,Update,etc..." checkbox may not be visible if you are not returning a Primary Key field from the database or if you do not have one defined. You must return a PRimary Key field from the select statement for the SQL DataSource to be able to update the records.

|||

hello dear javan

i have that problem(update&.. checkboxes) for about 6 days but ur answers help me tp solve it.

so thanks for ever

be lucky and successful like always

Monday, February 27, 2012

How can I get the port of a named instance of SQL Server

Thanks for Microsoft's Windows XP Service Pack 2 and Windows Server 2003 that make the security much stronger. However, besides the invisible benefit so far, I have become the victim of this security policy.

I have several named instances of SQL 7/2000 installed in my machine. They are not visible out of the Microsoft new fire wall. I need to access the instances from outside the fire wall, but I don't know which port I should open for the instances.

From SQL online, the default instance of SQL server is connected through TCP/IP by default port 1433. I could successful open that port and made the default instance visible to outside. However, the port 1433 doesn't work for the named instances. SQL online said, the port for named instance is dynamically (by default) chosen the first time the instance is started. So, actually, I have no way to know the port.

Is there anyway that I can check the database or somewhere to get the port that is used by the named instance?

Thanks for any input and recommendation.> I am the first victim of this security policy.

don't kid yourself. a lot of people have been caught out - many by inadequate preparation or by a simple naivete. your problem seems more of an actual gotcha though.

try turning off the firewall and doing a netstat -a|||Hi, Atrax, thanks for your input. But, ...|||wtf? I didn't follow that at all.|||Never mind.

By the way, I got the solution for the original question. Using SQL Server Network Utility can find all ports for default and named instances.

Sunday, February 19, 2012

How can I find out which filegroup a table belongs to?

Hi, everybody!
I made a database which has two filegroups. One is primary filegroup, and
the other is named FG_01.
I set FG_01 as default filegroup so that every table should be created on
it.
But I found today that a developer had created tables on primary filegroup.
I want to move these tables from primary filegroup to FG_01 filegroup.
But there are so many tables that it is difficult to find out which tables
are on primary filegroup.
How can I find out which filegroups a table belongs to by means of query?
Any advice would be appreciated.Hello Kim !
Try to use the undocumented Procedure to fugure out the Filegroups:
sp_objectfilegroup @.objid
HTH, Jens Süßmeyer.