Click here to Skip to main content
15,887,477 members
Home / Discussions / C#
   

C#

 
AnswerRe: Class methods for accessing/modifying multiple array variables Pin
Łukasz Nowakowski14-Jun-10 3:15
Łukasz Nowakowski14-Jun-10 3:15 
AnswerRe: Class methods for accessing/modifying multiple array variables Pin
Luc Pattyn14-Jun-10 3:26
sitebuilderLuc Pattyn14-Jun-10 3:26 
Questionhow i know when user created Pin
noamtzu0014-Jun-10 2:47
noamtzu0014-Jun-10 2:47 
AnswerRe: how i know when user created Pin
Pete O'Hanlon14-Jun-10 3:36
mvePete O'Hanlon14-Jun-10 3:36 
GeneralRe: how i know when user created Pin
noamtzu0014-Jun-10 18:33
noamtzu0014-Jun-10 18:33 
QuestionGetting a column or parameter's data type from the database [modified] Pin
JohnLBevan14-Jun-10 1:42
professionalJohnLBevan14-Jun-10 1:42 
AnswerRe: Getting a column or parameter's data type from the database Pin
PIEBALDconsult14-Jun-10 2:44
mvePIEBALDconsult14-Jun-10 2:44 
GeneralRe: Getting a column or parameter's data type from the database Pin
JohnLBevan14-Jun-10 8:40
professionalJohnLBevan14-Jun-10 8:40 
Ahh that's great - thanks for the info. It took me a bit of time to realise that columns were rows in the schema, so I've chucked some sample code below for anyone looking to do something similar:
DbConnection con = new SqlConnection(connectionstring);
DbCommand command = con.CreateCommand();
command.CommandType = CommandType.Text;
command.CommandText = "select * from dbo.DemoTable where 0=1";
command.Connection.Open();
using (IDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
{
    DataTable table = reader.GetSchemaTable();
    //foreach (DataColumn column in table.Columns)
    foreach(DataRow row in table.Rows)
    {
        //Console.WriteLine(string.Format("{0}: {1}",column.ColumnName,column.DataType.ToString()));
        Console.WriteLine(string.Format("{0}: {1}", row.Field<string>("ColumnName"), row.Field<Type>("DataType").ToString()));
    }
}
command.Connection.Close();
Console.WriteLine("Done");
Console.ReadKey();


However, this won't work for getting the input parameters for a stored proc. Do you know of an equivelant to the following?

SELECT name
from sys.types  
where user_type_id in 
(	
	select user_type_id	
	from sys.parameters 	
	WHERE object_id = OBJECT_ID('@schema.@storedProc')	
	and name='@paramName'
)


Thanks again for your help so far; it's very much appreciated.

Kind regards,

JB
GeneralRe: Getting a column or parameter's data type from the database Pin
PIEBALDconsult14-Jun-10 13:48
mvePIEBALDconsult14-Jun-10 13:48 
QuestionA few questions Pin
SRJ9214-Jun-10 1:12
SRJ9214-Jun-10 1:12 
AnswerRe: A few questions Pin
Eddy Vluggen14-Jun-10 2:08
professionalEddy Vluggen14-Jun-10 2:08 
GeneralRe: A few questions Pin
SRJ9214-Jun-10 10:08
SRJ9214-Jun-10 10:08 
GeneralRe: A few questions Pin
Eddy Vluggen14-Jun-10 10:38
professionalEddy Vluggen14-Jun-10 10:38 
QuestionLogin dialog on page loads Pin
Ramkithepower14-Jun-10 0:39
Ramkithepower14-Jun-10 0:39 
AnswerWrong forum - Try the ASP.NET forum. Pin
Pete O'Hanlon14-Jun-10 0:42
mvePete O'Hanlon14-Jun-10 0:42 
AnswerRe: Login dialog on page loads Pin
OriginalGriff14-Jun-10 0:43
mveOriginalGriff14-Jun-10 0:43 
AnswerRe: Login dialog on page loads Pin
Ramkithepower14-Jun-10 22:21
Ramkithepower14-Jun-10 22:21 
QuestionScalable Email service Pin
nitin_ion14-Jun-10 0:28
nitin_ion14-Jun-10 0:28 
AnswerRe: Scalable Email service Pin
OriginalGriff14-Jun-10 0:45
mveOriginalGriff14-Jun-10 0:45 
GeneralRe: Scalable Email service Pin
nitin_ion14-Jun-10 1:15
nitin_ion14-Jun-10 1:15 
QuestionFlow control using Asynch Sockets Pin
TimSWatson14-Jun-10 0:14
TimSWatson14-Jun-10 0:14 
AnswerRe: Flow control using Asynch Sockets Pin
Jimmanuel14-Jun-10 3:24
Jimmanuel14-Jun-10 3:24 
GeneralRe: Flow control using Asynch Sockets Pin
TimSWatson14-Jun-10 3:34
TimSWatson14-Jun-10 3:34 
GeneralRe: Flow control using Asynch Sockets Pin
Jimmanuel14-Jun-10 4:17
Jimmanuel14-Jun-10 4:17 
QuestionApplication localization (culture) DLLs Pin
Eli Nurman14-Jun-10 0:04
Eli Nurman14-Jun-10 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.