Home » 2011 (Page 2)

Archive for 2011

SQL Primary Key Constraint on alter table

– Login to your server MS SQL Management Studio Express – Expand the database; expand the tables folder, right click on the table “[your table name]”, click “Open Table.” Make sure the primary key column(s) have been declared to not contain NULL values (when the table was first created). With the open table click on […]

Arithmetic overflow error converting expression to data type datetime

Condition: <asp:SqlDataSource ID=”PolExpCurrentMo” runat=”server” ConnectionString=”< %$ ConnectionStrings:appConnectionString2 %>” SelectCommand=”SELECT * FROM [VendorList] WHERE _([EXPIRATION_DATE] >= @EXP_BEGIN) AND ([EXPIRATION_DATE] < @EXP_END) AND _([EXPIRATION_CONTACT] = @EXPIRATION_CONTACT) ORDER BY EXPIRATION_DATE "> <selectparameters> <asp:parameter DefaultValue=”YES” Name=”EXPIRATION_CONTACT” Type=”String” /> <asp:parameter Name=”EXP_BEGIN” Type=”String”/> <asp:parameter Name=”EXP_END” Type=”String” /> </selectparameters> Code behind default value ‘ *current months date parameter PolExpCurrentMo.SelectParameters(“EXP_BEGIN”).DefaultValue = _DateTime.Now.Month.ToString() + […]

Month, day and year code behind format

Day name and date format of Friday, 11/11/2011 Dim strDayName As String Dim curTime As New DateTime curTime = DateTime.Now.ToShortDateString() strDayName = curTime.DayOfWeek.ToString Response.Write(strDayName & “, ” & DateTime.Today) Result: Friday, 11/11/2011 Day name and date format of Friday, 11/11/2011 using case funtion Dim iDay As String Dim strDayName As String iDay = DatePart(“w”, DateTime.Now) […]