Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 commandtype

Author  Topic 

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-03-19 : 07:47:29
sir
i am using following code for hirarchy treeview.
and i am using asp.net with c#.and sql server.i
have 3 tables Indexmaster,sectormaster,indexsectormap.
i have error.


Error---

The CommandType enumeration value, 512,
is not supported by the .Net Framework
SqlClient Data Provider.
Parameter name: CommandType

my code---

sqlcon.ConnectionString = "Data source=tipl5;initial catalog=eERS;uid=gayatri;pwd=gayatri;Connect Timeout=120";
sqlcon.Open();

cmd.Connection =sqlcon;
cmd.CommandType = CommandType.TableDirect;

cmd.CommandText = "IndexMaster";
sqlda.SelectCommand = cmd;
sqlda.Fill(ds, "IndexMaster");

cmd.CommandText = "IndexSectorMap";
sqlda.SelectCommand = cmd;
sqlda.Fill(ds, "IndexSectorMap");

cmd.CommandText = "SectorMaster";
sqlda.SelectCommand = cmd;
sqlda.Fill(ds, "SectorMaster");

ds.Relations.Add("Root", ds.Tables["IndexMaster"].Columns["IndexCode"], ds.Tables["IndexSectorMap"].Columns["tIndexCode"]);
ds.Relations.Add("Secondary", ds.Tables["IndexSectorMap"].Columns["tSectorCode"], ds.Tables["SectorMaster"].Columns["SectorCode"]);
FpSpread1.DataSource = ds;

regards
gayatri

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-03-19 : 08:21:35
hi
pls help for this matter.
its imp for my project and also me.
so pls urgently help me.
gayatri
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-03-19 : 08:28:47
Don't use that command type, as mentioned it is not supported by SQL Server. You can use "Text" and just do "Select * from <table name>".

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-03-24 : 02:18:15
hello sir
if i use the stored procedure then can i use command type or my same code.
gayatri
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-03-24 : 05:34:06
If you use stored procedure, you have to use CommandType.StoredProcedure.
Check http://msdn2.microsoft.com/en-us/library/yy6y35y8(VS.71).aspx
Go to Top of Page
   

- Advertisement -