473,472 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Retrieve MS SQL TYPE TEXT into Dataset

Hello

i'm stuck on a seemingly small problem. i'm trying get the default value
of a column in a table on a MS SQL Server. i try to use sp_columns. eg
sp_columns @table_name = 'addresses'

in Query Analyzer this will produce a nice list where COLUMN_DEF
contains the default value. but if i fill a dataset with it, the column
COLUMN_DEF is always null! i even binded it to a datagrid and the column
shows up empty.
looking at the SP the column COLUMN_DEF seems to be of type TEXT. so i
guess this is the problem...

any idea on how solve this and get the value in COLUMN_DEF? i would like
to use a system stored procedure, not access the sysobjects directly.

thanks for any pointers!

beat
(i couldn't find any better matching ng. if there's one i'll happily
repost there)
Jul 21 '05 #1
1 1829
Luki wrote:
Hello

i'm stuck on a seemingly small problem. i'm trying get the default value
of a column in a table on a MS SQL Server. i try to use sp_columns. eg
sp_columns @table_name = 'addresses'

in Query Analyzer this will produce a nice list where COLUMN_DEF
contains the default value. but if i fill a dataset with it, the column
COLUMN_DEF is always null! i even binded it to a datagrid and the column
shows up empty.
looking at the SP the column COLUMN_DEF seems to be of type TEXT. so i
guess this is the problem...

any idea on how solve this and get the value in COLUMN_DEF? i would like
to use a system stored procedure, not access the sysobjects directly.

thanks for any pointers!

beat
(i couldn't find any better matching ng. if there's one i'll happily
repost there)

ok. i just checked this and retrieved a table containing a text field,
the dataset worked perfect. so type TEXT isn't responsible. what the...
here's the code to test:


System.Data.SqlClient.SqlConnection cn=
new System.Data.SqlClient.SqlConnection(cns);
System.Data.SqlClient.SqlCommand cmd=
new System.Data.SqlClient.SqlCommand();
System.Data.SqlClient.SqlDataAdapter da=
new System.Data.SqlClient.SqlDataAdapter();

System.Data.DataSet dsdb=
new System.Data.DataSet();

cmd.Connection=cn;

cmd.CommandType=System.Data.CommandType.StoredProc edure;
cmd.CommandText="sp_columns";
cmd.Parameters.Add("@table_name", "addresses");

da.SelectCommand=cmd;

da.Fill(dsdb);

this.DataGrid1.DataSource=dsdb;
this.DataGrid1.DataBind();
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KathyB | last post by:
Sorry this is a bit of a repost because I wasn't quite accurate in my original. I have an hmtl page with a function to see if there are any input type=text boxes. If so, that means a user did...
4
by: Jerry Orr | last post by:
I am attempting to retrieve various MVS dataset allocation parameters (lrecl, block size, etc) from a C/C++ program. The C/C++ Run-time Library Reference states that the function svc99() can be...
1
by: iporter | last post by:
Hi - I am changing a field from type nvarchar to type text, given that I need to store strings longer than 255 characters. To do this I change the data type in SQL Server, then I change the...
12
by: Randell D. | last post by:
Folks, I have a form called "ourTestForm". Its a test form - nothing special - it contains five input tags - they are named one, two, three, four and five. The input tags are of type...
1
by: Luki | last post by:
Hello i'm stuck on a seemingly small problem. i'm trying get the default value of a column in a table on a MS SQL Server. i try to use sp_columns. eg sp_columns @table_name = 'addresses' in...
16
by: Mark Rae | last post by:
Hi, Supposing I had a string made up of a person's name followed by their profession in parentheses e.g. string strText = "Tiger Woods (golfer)"; and I wanted to extract the portion of the...
1
by: subbugannamani | last post by:
I want to retrieve the text property of the buttons in another form (for C# desktop application).For ex in Form1.cs I have four buttons I want to get the text property of that 4 buttons in...
1
by: nightwalker | last post by:
hi all, I am trying to retrieve dynamic text value, but I need some helps with my script below. it doesn't get executed. Please help. for (var i =1; i <=3; i++) { ...
2
by: Nilanjan Sanyal | last post by:
how to retrieve hindi text from mysql database using php
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.