Showing posts with label integer. Show all posts
Showing posts with label integer. Show all posts

Thursday, March 22, 2012

Can't set varbinary(MAX) in Visio 2005

Why can't I use the new types in Visio 2005? When ever I type in MAX - it complains that MAX is not an integer?You need to do the following ( I will assume that you are creating a database model diagram):
1. Create new database model diagram
2. Go to Database -> Options -> Drivers
3. Select "Microsoft SQL Server" in the default driver for Visio
4. Click Setup
5. Pick "SQL Native Client" for ODBC drivers to use
6. Go to preferred settings tab and select 2005 in the preferred version drop-down under DDL script generation
7. Now when you create an entity and create a new column will see varchar(MAX), nvarchar(MAX), varbinary(MAX) and xml as data type options.|||Many thanks for that Umachandar!

Thursday, March 8, 2012

Cant Remember how to pass int value to datasource

I have know this error but have completely forgotten how to take care of it. How do I pass the integer values to the SQL statement?

ERROR: Syntax error converting the nvarchar value 'Label' to a column of data type int.

WHERE (LinkInfo.L_State = @.State) AND (LinkInfo.CG_ID > @.CatIDLow) AND (LinkInfo.CG_ID > @.CatIDHigh)

<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="State" PropertyName="Text" />
<asp:ControlParameter ControlID="Label2" DefaultValue="0" Name="CatIDLow" PropertyName="Text" />
<asp:ControlParameter ControlID="Label3" DefaultValue="1899" Name="CatIDHigh" PropertyName="Text" />
</SelectParameters>

CODE BEHIND

public partial class TopandBottomSelect : System.Web.UI.Page
{
int CG_IDlower;
int CG_IDupper;

protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
CG_IDlower = 0;
CG_IDupper = 1900;
Label1.Text = Convert.ToString(CG_IDlower);
Label2.Text = Convert.ToString(CG_IDupper);
}
else
{
CG_IDlower = 1899;
CG_IDupper = 3000;
Label1.Text = Convert.ToString(CG_IDlower);
Label2.Text = Convert.ToString(CG_IDupper);
}
GridView1.DataBind();
}
}

Thank you

Add the datatype to the Parameter declarations:

<asp:ControlParameter ControlID="TextBox1" Name="State" PropertyName="Text"Type="Int32" />

|||

The state value is not the problem, just the CatID High and low. I have tried the below with no success.

NEW EDITED CODE Below - same error

ERROR: Input string was not in a correct format.

WHERE (LinkInfo.L_State = @.State) AND (LinkInfo.CG_ID > @.CatIDLOW) AND (LinkInfo.CG_ID < @.CatIDHIGH)">

<asp:ControlParameter ControlID="Label2" Name="CatIDLow" PropertyName="Text" Type="Int32" />
<asp:ControlParameter ControlID="Label3" Name="CatIDHigh" PropertyName="Text" Type="Int32" />

with this Code Behind:

int CG_IDlower;
int CG_IDupper;
int CatIDLOW;
int CatIDHIGH;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
CG_IDlower = 0;
CG_IDupper = 1900;
Label2.Text = Convert.ToString(CG_IDlower);
Label3.Text = Convert.ToString(CG_IDupper);

CatIDLOW = Convert.ToInt32("Label2.Text");
CatIDHIGH = Convert.ToInt32("Label3.Text");
}
else
{
CG_IDlower = 1899;
CG_IDupper = 3000;
Label2.Text = Convert.ToString(CG_IDlower);
Label3.Text = Convert.ToString(CG_IDupper);
CatIDLOW = Convert.ToInt32("Label2.Text");
CatIDHIGH = Convert.ToInt32("Label3.Text");
}
GridView1.DataBind();
}

|||

I am not sure but I think this may have something to do with the object type coming out of the radiobuttonlist control. don't know where to go from where I am.

thank you,