.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Problem when using getObject to retrieve the value of the IS_AUTOINCREMENT-Column

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :
 

 

Hello,

Using the JDBC driver, I try to get all values of the Column-Metadata-Resultset using the following code:

 

DatabaseMetaData md= connection.getMetaData();
Resultset rs = md.getColumns(null, null, "mytable", null);

ResultSetMetaData rsmd = resultSet.getMetaData();
int n_column = rsmd.getColumnCount();


while(rs.next()){
	for (int i = 0; i < n_column; i++) {			
		Object o = rs.getObject(i+1);
System.out.println(o); } }

 

Unfortunately, this produces the following error message for the IS_AUTOINCREMENT-Column:

com.microsoft.sqlserver.jdbc.SQLServerException: Die Konvertierung von "char" in "SMALLINT" wird nicht unterstützt.

Which roughly translates to "SMALLINT" cannot be converted to "char".

When I skip this column, it works without problems. It also works when I change getObject to getString, however that is not really an option, as this is actually part of a bigger program that needs to deal with generic database queries and resultsets.

 

I use SQL Server 2008 Standard (Version: 10.0.1600), running on Windows Server 2008.

I tried the newest version of the JDBC driver and the CTP for version 4.0, but they all exhibit the same behaviour.



View Complete Post


More Related Resource Links

Problem inserting into XML column

  
I have a C# application that inserts XML into Sql Server 2005.  When the message is more than 300 lines or so, it doesn't make it there.  The data shows in the application variables (stringWriter) but doesn't get inserted and that's confirmed looking in Profiler. The stored procedure is simply:          usp_WS_OrderEntry_InsertWSOrder @doc=@p1,@WSOrderId=@p2 output       INSERT INTO WS_OrderEntry_Order (OrderXML)       VALUES(@doc)  ..... C# .....             tableAdapter.usp_WS_OrderEntry_InsertWSOrder(stringWriter.ToString(), ref wsOrderId); .... In any cases, the variable "stringWriter" contains the data (as text). In profiler for a successfull call: declare @p1 xml set @p1=convert(xml,N'<OrderHeader><CustomerNumber>1234</CustomerNumber><Pr.....</PO></ShipToName> declare @p2 int set @p2=1077 exec dbo.usp_WS_OrderEntry_InsertWSOrder @doc=@p1,@WSOrderId=@p2 output select @p2 In unsuccessfull call: It shokes on the convert part and doesn't display any data (and doesn't insert as well).  I looked in LOGs, events and didn't find anything. Any help appreciated.  Thanks.

wpf charting column series data binding problem

  
I'm trying to build a chart using the columnSeries from the wpf toolkit and I appear to be having trouble with the data binding. Here is the xaml: <Grid>    <chartingToolkit:ColumnSeries Height="18" HorizontalAlignment="Left" Margin="188,169,0,0" Name="columnSeries1" VerticalAlignment="Top" Width="18" IndependentValueBinding="{Binding Path=Date}" DependentValueBinding="{Binding Path=Value}" /></Grid> In the code behind, I'm calling a stored procedure and putting the result in a datatable like this: string connString = ConfigurationManager.ConnectionStrings["string"].ConnectionString;            using (SqlConnection cn = new SqlConnection(connString))            {                DataTable dt = new DataTable("T1");                cn.Open();                SqlCommand cmd = new SqlCommand("T1_sp", cn);                cmd.CommandType = CommandType.StoredProcedure;                  SqlDataAdapter da = new SqlDataAdapter(cmd);                da.Fill(dt);                columnSeries1.ItemsSource = dt.DefaultView;                cn.Close();            } No error is being generated but I'm not getting a column chart either. If I take the same command and put it into a datagrid, it works fine. What do I need to do to get this into my column chart? If it helps,

ssis sql 2000 image to 2008 varbinary Failed to retrieve long data for column

  
Hi, I have a task that to migrate the image type column from sql 2000 to varbinary type in sql 2008. The source column having 3812353 max datalength size for the column. The package always failed with following error message. [OLE DB Source [13177]] Error: Failed to retrieve long data for column "attch_file_content_t". [OLE DB Source [13177]] Error: There was an error with output column "attch_file_content_t" (13209) on output "OLE DB Source Output" (13187). The column status returned was: "DBSTATUS_UNAVAILABLE". [OLE DB Source [13177]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "output column "attch_file_content_t" (13209)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "attch_file_content_t" (13209)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. Meng Chew

Problem while retrieving data from a lookup column from sharepoint linq.

  
Hi I am working with sharepoint linq concept. When I am giving a query with lookup column It's working fine.  But when i am trying to retrieve the data from a look up column to spgridview. I was unable to get the output. Here is the above code which i have worked.   string strTitle = string.Empty; string strStatus=string.Empty; var context = new LinqSampleDataContext(SPContext.Current.Web.Url); EntityList<SharePoint2010ConceptsItem> Concept = context.GetList<SharePoint2010ConceptsItem>("SharePoint 2010 Concepts"); var query = from cs in Concept where cs.Status.Title.ToString()!="Completed" select new { cs.Title, cs.Id, //cs.Status }; sgvConcepts.DataSource =query; sgvConcepts.DataBind();   Any help me plz how to retrieve the data from a lockup column.bvnprasad

Problem with Retrieving data from lookup column using SharePoint 2010 Linq Concept

  
Hi I am working with sharepoint linq concept. When I am giving a query with lookup column It's working fine.  But when i am trying to retrieve the data from a look up column to spgridview. I was unable to get the output. Here is the above code which i have worked.   string strTitle = string.Empty; string strStatus=string.Empty; var context = new LinqSampleDataContext(SPContext.Current.Web.Url); EntityList<SharePoint2010ConceptsItem> Concept = context.GetList<SharePoint2010ConceptsItem>("SharePoint 2010 Concepts"); var query = from cs in Concept where cs.Status.Title.ToString()!="Completed" select new { cs.Title, cs.Id, //cs.Status }; sgvConcepts.DataSource =query; sgvConcepts.DataBind();   Any help me plz how to retrieve the data from a lockup column.bvnprasad

Problem when using calculated column as column group in a view

  
Hi,   I have a list with a calculated column named 'FullName', the formula is: "FirstName & " " &  LastName". I created a view group by 'FullName' column. The follow error appeared on the column:   &lt;!-- #RENDER FAILED --&gt;   Please help

Retrieve month name and last 2 digit of yr from date column

  
Table contain one column [d_matur] [datetime] NULL 2014-06-20 00:00:00.000 2015-03-20 00:00:00.000 like this now I want to retrieve month name like June as well as last two digit of year like 14 if anyone know query how to get these from above column please let me know.Thanks

GridView column/row data binding problem

  
Hi All, I have a table with the following structure: Attribute------------- AttributeIdWeekNoDayNoAttribute1Attribute2Attribute3Attribute4Attribute5 ........ likewise. I want to display these data in a gridview in the following manner                                  Sunday    Monday Tuesday ............ (till Saturday) - should be gridview columns, I can retrieve this using dayno Attribute 1 Attribute 2 Attribute 3 Attribute 4 .......... like wise attributes should be taken in to rows.Is this possible in a gridview, if so how can I do that?

how to retrieve various date format from datetime datatype column

  

first table

Area_code (varchar)    Loan_date (datetime)

USA                             9/21/2009  12:00:00 AM

CAN                            10/22/2010  12:00:00 AM

ARG                            12/23/2009 12:00:00 AM

Second table

Area_code (varchar)    Date_format(varchar)

USA                             dd/mm/yy

CAN                             yy.d.m

ARG                            yy'?'d'?'m'?'

I want to add Loan_date column in second t

how to retrieve various date format from datetime datatype column

  

first table

Area_code (varchar)    Loan_date (datetime)

USA                             9/21/2009  12:00:00 AM

CAN                            10/22/2010  12:00:00 AM

ARG                            12/23/2009 12:00:00 AM

Second table

Area_code (varchar)    Date_format(varchar)

USA                             dd/mm/yy

CAN                             yy.d.m

ARG                            yy'?'d'?'m'?'

I want to add Loan_date column in second table and nee

spmetal generated class and content type (for page layout) retrieve problem

  

I'm working with a console application to generate my sites and subsites (hierarchy). And i've got a problem with a generated spmetal class.

 

this doesn't work:

 

static void Main(string[] args)

        {

            string SITE = string.Concat("http://"Environment.MachineName);         

 

            

Problem with an XML type column in this SQL Statement

  

If I use an XML type variable (@xml) everything is fine with the following SQL:

SELECT p.number as Position,
  x.value('(../name)[1]','VARCHAR(200)') AS SectionName,
  x.value('(./label)[1]','VARCHAR(200)') AS Name
FROM master..spt_values p
CROSS APPLY @xml.nodes('/xxxx_settings/section/setting[position()=sql:column("number")]') n(x) where p.type = 'p'

However, when I try to store my XML data in a table that has an XML column the following query doesn't work:

SELECT p.number as Position,
  x.value('(../name)[1]','VARCHAR(200)') AS SectionName,
  x.value('(./label)[1]','VARCHAR(200)') AS Name
FROM master..spt_values p,
  dbo.XmlDataHolder a
CROSS APPLY a.XmlData.nodes('/xxxx_settings/section/setting[position()=sql:column("p.number")]') n(x) where p.type = 'p'

The error is "The column prefix 'p' does not match with a table name or alias name used in the query."

What am I missing here?


Problem with getting extra data in column of gridview

  

I have created a gridview based on an SQL Datasource.  The grid view contains several columns(fields) one of which is called "Amount".  In the footer of the gridview their is a field that contains the sum of all of the values contained in the "Amount" field.

By problem is that in instead of getting the value of the Amount displayed in the "Amount" field of each row, I am getting a '0' (Example: 0 25.78 when I should just be getting 25.78.  There is a space between the '0' and the '25.78'.

Code is as follows:

 

<asp:TemplateField HeaderText="Amount" SortExpression="Amount">

ODBC API to retrieve User-Defined DataType of a Column in a ResultSet ?

  

Hi,

ODBC APIs such as SQLDescribeCol(), SQLColAttribute() could be used to retrieve SQLDataType of a particular column in a ResultSet.

Similarly, Is there any ODBC API which could be used to retrieve User-Defined DataType of a particular column in a ResultSet?

-Vengatesh

 


Problem with translation of column names

  

Hi,

we have a Sharepoint 2007 Installation with german language packs.

I created a new english site collection and inside the new collection a new document library.
And there I have the problem. The system columns like "modified by" and "modified" have german names: "Geändert von" and "Geändert".

Any idea how I can solve this problem?

Thanks in advance
Joe


Error while merging: "Could not retrieve column info from table tablename" and Could not find stored

  

Hi i am getting following error message while merging. Can any one please help?

We are using sql server 2005
I have this problem in publisher.Gone throught his article http://social.msdn.microsoft.com/Forums/en/sqlreplication/thread/b0bbc330-91df-45d5-8dbf-e2df461a8005 but no luck.

The merge process could not retrieve column information for table 'dbo.tablename'. Verify that you have sufficient privileges on the database and retry the operation. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201016)
Get help: http://help/MSSQL_REPL-2147201016

Could not find stored procedure 'dbo.MSmerge_sel_sp_6481B06512B54C91FCC171C542E7'. (Source: MSSQLServer, Error number: 2812)
Get help: http://help/2812

Thanks


Problem while creating a column in custom list

  
I am using sharepoint 2010 beta2

I tried to create a column in custom list using a button in ribbon as well as in list settings page

After filling the data and clicking on 'OK' button I am getting a JavaScript error and form is not being submitted

Javascript error details:

Message: 'undefined' is null or not an object
Line: 1423
Char: 4
Code: 0

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend