Server Error in '/' Application.

Conversion failed when converting the varchar value 'index' to data type int.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value 'index' to data type int.

Source Error:


Line 3:      Layout = "_Layout.cshtml";
Line 4:     var db = WebMatrix.Data.Database.Open("mvcconnection");
Line 5:      var blg = db.QuerySingle("select * from table_blog where id='" + UrlData[1].ToString().Split('.').First() + "'");
Line 6:  
Line 7:      var pageSize =6;

Source File: g:\pleskvhosts\advid.in\squareit.in\blog_detail.cshtml    Line: 5

Stack Trace:


[SqlException (0x80131904): Conversion failed when converting the varchar value 'index' to data type int.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +3335264
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +334
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4679
   System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) +255
   System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) +298
   System.Data.SqlClient.SqlDataReader.Read() +43
   System.Data.Common.DbEnumerator.MoveNext() +54
   WebMatrix.Data.<QueryInternal>d__0.MoveNext() +311
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +209
   ASP._Page_blog_detail_cshtml.Execute() in g:\pleskvhosts\advid.in\squareit.in\blog_detail.cshtml:5
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +99
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +185
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +142


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0